In my project, I want to display a popup and the view of this popup is defined in a .xib file.
To do that I use this line of code :
myPopupView = NSBundle.mainBundle().loadNibNamed("NibView", owner: self, options: nil) as! UIView
This is very common error which means the
IBOutlet you have taken in .xib is not connected to the relevant class. This kind of error I experience when i have taken a outlet and given some name like
lblUserName but later i renamed that to lblFriendName, then the label in xib is still connected to lblUserName as well as lblFriendName, so at the time of compilation the xib did not find the connection for lblUserName and throws error.
So go to your xib, right click on the outlet in the xib, then you will see the cross button to disconnect. So disconnect it and connect it again.
During that also you can see the connection name, it must be wrong name or there would be two connection foe the same label in which one would be correct and another must be wrong (This case when you rename a connection as i explained)
Hope you understand, and it helps...
Happy coding ...