Skip to content

Instantly share code, notes, and snippets.

@eunjin3786
Created January 25, 2022 09:01
Show Gist options
  • Save eunjin3786/1e2da2bf9a061a8b4a6e878ec1cede5c to your computer and use it in GitHub Desktop.
Save eunjin3786/1e2da2bf9a061a8b4a6e878ec1cede5c to your computer and use it in GitHub Desktop.
let observable = Observable<Int>.interval(.seconds(1), scheduler: MainScheduler.instance)
observable.subscribe(onNext: { value in
print("Got a value:", value)
}, onError: { error in
print("Got an error:", error)
}, onCompleted: {
}, onDisposed: {
}).disposed(by: disposeBag)
// Prints
Got a value: 0
Got a value: 1
Got a value: 2
Got a value: 3
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment