Skip to content

Instantly share code, notes, and snippets.

@eroth
Last active March 17, 2019 18:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eroth/0e23c881c5a4458353a265ec7f1ef24c to your computer and use it in GitHub Desktop.
Save eroth/0e23c881c5a4458353a265ec7f1ef24c to your computer and use it in GitHub Desktop.
let disposeBag = DisposeBag()
func doSomethingRx() -> Observable<String> {
return Observable.create { observer in
observer.onNext("We're using RxSwift!")
return Disposables.create()
}
}
doSomethingRx()
.subscribe(onNext: { result in
print("result: \(result)")
})
.disposed(by: disposeBag)
// prints "result: We're using RxSwift!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment