I'm trying to do something quite simple, actually I have just started a new project and I have added a button in the main view of the Storyboard. Then when I click on this button, it just load a new view which is in my xib file. For that, I use this line code :
if let newView = NSBundle.mainBundle().loadNibNamed("myView", owner: self, options: nil).first as? myView {
contentView.addSubview(newView)
}
So until here, everything works. But now, I want to add in my class (UIView) which is linked to my xib file, a IBOutlet. For that, I just do "CTRL + Drag" my view in my class and add a IBOutlet, but from there, I have an error when I run the program : setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key...
I have search for an answer, but on Internet everyone just say to remove the IBOutlet. So of course after that it works, but I need to have it. Is there a way to do that ? Actually I think yes because I have downloaded a project on github and it works. Actually, I just try to reproduce what he has done, but I always have my error. The git project I try to do is this one : https://github.com/J3Patel/collectionView-iOS-Swift
Thanks for your help :)
Rgds,