Skip to content

Instantly share code, notes, and snippets.

@joshdholtz
Last active March 22, 2016 14:26
Show Gist options
  • Save joshdholtz/eddf51a52af8d35f376f to your computer and use it in GitHub Desktop.
Save joshdholtz/eddf51a52af8d35f376f to your computer and use it in GitHub Desktop.
Should add to dispose bag
class ViewController : UIViewController {
let viewModel = ViewModel()
private let disposeBag = DisposeBag()
override func viewDidLoad(){
super.viewDidLoad()
self.viewModel.navigationVariable.asObservable()
.subscribeNext { data in
let newViewModel = NewViewModel(data)
let newViewController = NewViewController()
newViewController.viewModel = newViewModel
self.navigationController?.pushViewController(newViewController, animated:false)
}.addDisposableTo(disposeBag)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment