酢日報

ch3coohの日報。このブログはひっそりと運営しています

2017-07-02 ch3cooh

Microsoft MVPは再受賞できなかったので8年で終わり。MSのモバイル部門はXamarinの方向に舵を切ったのか、Windows Mobileではあまり精力的な新技術の発表がみられなくなってしまった。日本国内はほぼiOSとAndroidのみとなってしまい、個人的に魅力を感じなくなってしまったのもあり、僕自身も積極的に活動しなくなってしまった。

趣味開発

iOSではBrightFuturesを使ってコードを書いているところをAndroidでもわかりやすく書きたい。

    //ログイン
    static func login(userId: String?, password: String?) -> Future<Bool, APIError> {
        let promise = Promise<Bool, APIError>()
        guard let userId = userId, let password = password else {
            promise.failure(APIError.argument)
            return promise.future
        }
        
        Alamofire.request(request).responseData { (response) in
            guard let data = response.data, let response = response.response else {
                promise.failure(APIError.invalidConnection)
                return
            }
            promise.success(true)
        }
        return promise.future
    }

こういう用途の場合にはRxJavaを使うのが良いのだろうか?

ブログに書いてみた。