Loaded nib but the view outlet was not set - Swift edition

If you have tried everything and you still get this error, try re-creating the class file from scratch but remember to select the "Also create XIB file" check box. This will auto link up a few items that are not linked when creating these files separately. After this is created, you can likely cut and paste everything onto the new XIB and it should work fine.

I am finding this issue specifically with creating files separately in Swift.


  • First - set custom class in your nib file (File's Owner -> third icon -> custom class : YourViewController )
  • Second - the last icon in file's owner -> link (drag) the "view" property to the interface view

Init your ViewController like so:

YourViewController(nibName: "YourViewName", bundle: nil)

It will work. Don't do any manipulations with View.


I had the same problem , my 2nd view on my view controller couldn't load . I changed the view's name in property(as I had previously given "View"). Your existing view controller already had references to the view on top of it with the same name(View). Hence the error . Try changing the outlet names . It worked perfect in my case .