Skip to content

Instantly share code, notes, and snippets.

@eunjin3786
Last active June 28, 2019 05:28
Show Gist options
  • Save eunjin3786/55d2fe9fa454b5ffe2a03bd7ad2045e7 to your computer and use it in GitHub Desktop.
Save eunjin3786/55d2fe9fa454b5ffe2a03bd7ad2045e7 to your computer and use it in GitHub Desktop.
[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