Skip to content

Instantly share code, notes, and snippets.

@gabro
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabro/c2188b2f6f1d01108124 to your computer and use it in GitHub Desktop.
Save gabro/c2188b2f6f1d01108124 to your computer and use it in GitHub Desktop.
UIViewController producing values. Example of editing a profile section with a modal interaction, which can produce a new Patient
// Create a ViewController automatically wrapped in a UINavigationController
// returns the viewController and a Signal<Patient, NoError>
let (profileVC, signal) = EditPersonalInfoViewController.wrappedInNavigationController(patient: patient)
// observe the signal. When a new Patient is produced, update the view
// dismiss the view controller whenever the signal is completed (i.e. modifications have been saved or interaction has been canceled)
signal.observe(next: reloadViewForPatient, completed: dismissViewController)
// let the game being
self.presentViewController(profileVC, animated: true, completion: nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment