Skip to content

Instantly share code, notes, and snippets.

@djds23
Created January 25, 2019 04:39
Show Gist options
  • Save djds23/221d8df5ce9419f6ee6d33b1c699c7a0 to your computer and use it in GitHub Desktop.
Save djds23/221d8df5ce9419f6ee6d33b1c699c7a0 to your computer and use it in GitHub Desktop.
func waitForResourceAndButtonTap(
resource: Observable<Bool>,
buttonTap: Observable<Void>
) -> Observable<Bool> {
let emitOnlyAfterResourceHasArrived = Observable
.combineLatest(
buttonTap,
resource.take(1)
)
return emitOnlyAfterResourceHasArrived
.withLatestFrom(resource)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment