Skip to content

Instantly share code, notes, and snippets.

@bwhiteley
Created November 13, 2017 01:02
Show Gist options
  • Save bwhiteley/28359596934b62f19e3711d434560a8d to your computer and use it in GitHub Desktop.
Save bwhiteley/28359596934b62f19e3711d434560a8d to your computer and use it in GitHub Desktop.
class DetailViewController: UIViewController {
@IBOutlet var label: UILabel! {
didSet {
label?.text = episode.title
}
}
let episode: Episode
init(episode: Episode) {
self.episode = episode
// `nil` nibName means it will look for a nib with the same name as this class.
// Or, provide an explicit name if you prefer.
// `Bundle(for: type(of: self))` makes this VC safe to put in a framework.
super.init(nibName: nil, bundle: Bundle(for: type(of: self)))
}
@available(*, unavailable) // remove it from autocomplete suggestions
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
// ...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment