Skip to content

Instantly share code, notes, and snippets.

@shanev
Last active May 2, 2017 04:07
Show Gist options
  • Select an option

  • Save shanev/016fac5ee7cb9f11bf6fc08bd171ab95 to your computer and use it in GitHub Desktop.

Select an option

Save shanev/016fac5ee7cb9f11bf6fc08bd171ab95 to your computer and use it in GitHub Desktop.
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
super.prepare(for: segue, sender: sender)
guard
let viewController = segue.destination as? CustomViewController
else { return }
// compiler knows that CustomViewModel is our view model type
viewController.viewModel = CustomViewModel(data: "hello")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment