Skip to content

Instantly share code, notes, and snippets.

@FranDepascuali
Created January 26, 2016 18:34
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 FranDepascuali/5df62373ce98425d5c20 to your computer and use it in GitHub Desktop.
Save FranDepascuali/5df62373ce98425d5c20 to your computer and use it in GitHub Desktop.
public class MyViewController: UIViewController {
var viewModel: MyViewModel? {
willSet(maybeViewModel) {
if let _ = self.viewModel {
unbindViewModel()
}
}
didSet {
if isViewLoaded(), let viewModel = self.viewModel {
bindViewModel(viewModel)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment