Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save eofster/03bd1cfd8e16051f3365 to your computer and use it in GitHub Desktop.

Select an option

Save eofster/03bd1cfd8e16051f3365 to your computer and use it in GitHub Desktop.
Property-based dependency injection in view controller with one if statement
class ViewController: UIViewController {
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == PhotoDetailViewControllerIdentifier,
let viewController = segue.destinationViewController as? PhotoDetailViewController {
viewController.photo = Photo()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment