Skip to content

Instantly share code, notes, and snippets.

@laiso
Last active March 21, 2017 04:28
Show Gist options
  • Save laiso/87f37627ca7e4996c869ee74e015c75a to your computer and use it in GitHub Desktop.
Save laiso/87f37627ca7e4996c869ee74e015c75a to your computer and use it in GitHub Desktop.
完了してもキャンセルしてもtearDownをdriveするんだというのを表現したい https://twitter.com/laiso/status/844021792750555137 #CodePiece
let tearDown = Driver.combineLatest(cancelButton.rx.tap.asDriver(),
viewModel.completetion.asDriver(onErrorJustReturn: false)) { ($0, $1) }
.drive(onNext: { [unowned self] in
HUD.hide()
self.view.endEditing(true)
self.dismiss(animated: true, completion: nil)
})
tearDown.addDisposableTo(disposeBag)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment