Skip to content

Instantly share code, notes, and snippets.

@srdanrasic
Created February 19, 2017 13:54
Show Gist options
  • Save srdanrasic/64a156b7e6bb0a66f69d73a8e9977df0 to your computer and use it in GitHub Desktop.
Save srdanrasic/64a156b7e6bb0a66f69d73a8e9977df0 to your computer and use it in GitHub Desktop.
extension Authentication {
public typealias Scene = (
viewController: UIViewController,
token: SafeSignal<Token>
)
public func createScene() -> Scene {
let vc = ViewController.Authentication()
let credentials = combineLatest(
vc.usernameTextField.reactive.text.ignoreNil(),
vc.passwordTextField.reactive.text.ignoreNil()
)
vc.loginButton.reactive.tap
.with(latestFrom: credentials) { $1 }
.observe(with: self.credentials)
.dispose(in: vc.reactive.bag)
return (vc, token)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment