I've defined a base class with an outlet and attached the outlet to the view in the nib file
class BaseController: UIViewController {
@IBOutlet weak var myView : UIView!
and then created a subclass
class SubViewController: BaseController {
override func viewDidLoad() {
myView.backgroundColor = UIColor.red //The app crashes here
When i call BaseController()
it view appears, but when I call SubViewController()
the app crashes because myView
is nil. The files owner on the nib file is BaseController.