Skip to content

Instantly share code, notes, and snippets.

@dennisfarandy
Created September 3, 2015 09:46
Show Gist options
  • Save dennisfarandy/2c6e509e91ceb5005336 to your computer and use it in GitHub Desktop.
Save dennisfarandy/2c6e509e91ceb5005336 to your computer and use it in GitHub Desktop.
initialization viewcontroller by : http://napora.org/nscoder-and-swift-initialization/
class FooViewController: UIViewController {
let name: String
init(_ coder: NSCoder? = nil) {
name = "Bar"
if let coder = coder {
super.init(coder: coder)
} else {
super.init(nibName: nil, bundle:nil)
}
}
required convenience init(coder: NSCoder) {
self.init(coder)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment