Skip to content

Instantly share code, notes, and snippets.

@deda9
Created June 18, 2019 08:53
Show Gist options
  • Save deda9/102174b7f1a34e02abd4afac442bc04c to your computer and use it in GitHub Desktop.
Save deda9/102174b7f1a34e02abd4afac442bc04c to your computer and use it in GitHub Desktop.
Create RxObservable with timer
func createRxObservable() {
let source: Observable<Int> = Observable<Int>.timer(3, scheduler: ConcurrentDispatchQueueScheduler.init(qos: DispatchQoS.background))
source
.subscribe(onNext: { number in
print("Current emitted number: ", 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