Skip to content

Instantly share code, notes, and snippets.

@deda9
Created June 18, 2019 08:43
Show Gist options
  • Save deda9/f38c20d44a978be6240e50f32bdb5de0 to your computer and use it in GitHub Desktop.
Save deda9/f38c20d44a978be6240e50f32bdb5de0 to your computer and use it in GitHub Desktop.
Create RxObservable with interval
func createRxObservable() {
let source: Observable<Int> = Observable.interval(1, scheduler: ConcurrentDispatchQueueScheduler.init(qos: DispatchQoS.background)).take(3)
source
.subscribe(onNext: { number in
print("Second: ", number)
}, onError: { _ in print("On Error") },
onCompleted: { print("Complete") },
onDisposed: nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment