Skip to content

Instantly share code, notes, and snippets.

@aainaj
Last active May 5, 2018 15:13
Show Gist options
  • Save aainaj/cad6363ff2cca48fc6e657f043613065 to your computer and use it in GitHub Desktop.
Save aainaj/cad6363ff2cca48fc6e657f043613065 to your computer and use it in GitHub Desktop.
RxSwift share operator
let observable = Observable.from([1, 2, 3]).share()
let disposeBag = DisposeBag()
observable.subscribe(onNext: { element in
print("⛴ \(element)")
}).addDisposableTo(disposeBag)
observable.subscribe(onNext: { element in
print("✈️ \(element)")
}).addDisposableTo(disposeBag)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment