Created
May 7, 2018 20:14
-
-
Save jsorge/f9499795cb82bbffe06e17fad276c274 to your computer and use it in GitHub Desktop.
Nibless View Controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import UIKit | |
class ViewController: UIViewController { | |
init() { | |
super.init(nibName: nil, bundle: nil) | |
} | |
@available(*, unavailable, message: "Loading this view controller from a nib is unsupported.") | |
override convenience init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { | |
self.init() | |
} | |
@available(*, unavailable, message: "Loading this view controller from a nib is unsupported.") | |
required init?(coder aDecoder: NSCoder) { | |
fatalError("init(coder:) has not been implemented") | |
} | |
} | |
class ListViewController: ViewController { | |
let list: [String] | |
init(list: [String]) { | |
self.list = list | |
super.init() | |
} | |
} | |
let vc = ListViewController(list: ["hello", "world"]) | |
print(vc.list) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment