Skip to content

Instantly share code, notes, and snippets.

@hermanbanken
Last active June 5, 2019 05:32
Show Gist options
  • Select an option

  • Save hermanbanken/7f519d95d83c95fc2fb46f27e8986182 to your computer and use it in GitHub Desktop.

Select an option

Save hermanbanken/7f519d95d83c95fc2fb46f27e8986182 to your computer and use it in GitHub Desktop.
// Using RxSwift Observables
let observable: Observable<Int> = Observable.create { observer in
// could be anything async, e.g. a network call
DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(2), execute: {
observer.onNext(42)
observer.onCompleted()
})
return Disposables.create()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment