Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save eofster/0d409b312357b7b6a896 to your computer and use it in GitHub Desktop.
Save eofster/0d409b312357b7b6a896 to your computer and use it in GitHub Desktop.
Property-based dependency injection in view controller
class ViewController: UIViewController {
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == PhotoDetailViewControllerIdentifier {
if 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