Last active
June 28, 2019 05:28
-
-
Save eunjin3786/55d2fe9fa454b5ffe2a03bd7ad2045e7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[1,2,3,4,5].toObservable() | |
.subscribeOn(MainScheduler.instance) | |
.doOnNext { | |
UIApplication.sharedApplication().networkActivityIndicatorVisible = true | |
} | |
.observeOn(backgroundScheduler) | |
.flatMapLatest { | |
HTTPBinDefaultAPI.sharedAPI.get($0) | |
} | |
.observeOn(MainScheduler.instance) | |
.subscribe { | |
UIApplication.sharedApplication().networkActivityIndicatorVisible = false | |
} | |
// 출처: http://minsone.github.io/programming/reactive-swift-observeon-subscribeon |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment