Latcie Latcie - 9 months ago 47
iOS Question

Referencing outlet file's owner

I can't figure out why it's crashing with "this class is not key value coding-compliant for the key profilePic" in this picture.

enter image description here


With storyboard scenes, the view controller instance class is set by the custom class assigned to the view controller scene. With NIB files you are responsible for initialising the correct class instance yourself:

Rather than

let initialViewController = UIViewController.init(nibName: "InitialViewController", bundle: nil) as! InitialViewController

You need to have

let initialViewController = InitialViewController(nibName:"InitialViewController". bundle: nil)