Skip to content

Instantly share code, notes, and snippets.

@M0rtyMerr
Last active January 23, 2019 13:20
Show Gist options
  • Save M0rtyMerr/18162b32c5f3efe57fccbe8ec416aa60 to your computer and use it in GitHub Desktop.
Save M0rtyMerr/18162b32c5f3efe57fccbe8ec416aa60 to your computer and use it in GitHub Desktop.
RxSwiftExt fromAsync. Rx frameworks can be found here - https://github.com/RxSwiftCommunity/RxGesture
// materialized + errors, elements
let checkinEvents = checkin
.flatMapLatest { [checkinService] in
checkinService.post(checkinRequest: $0).asObservable().materialize()
}
.share()
checkinEvents
.elements()
.bind(to: showSuccessScreen)
.disposed(by: disposeBag)
checkinEvents
.errors()
.map { _ in "Something went wrong" }
.bind(to: showError)
.disposed(by: disposeBag)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment