I want to load a UIView from a XIB file, and I was able to do so successful via:
let nib = UINib(nibName: "CardView", bundle: nil).instantiateWithOwner(nil, options: nil).first as! UIView
Where CardView is the name of my XIB file. Now when I try to add an IBOutlet to the XIB file:
I get this error:
'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key phraseLabel.
I have checked that there aren't any orphan IBOutlets in the XIB file. So thinking that it was because I didn't cast the nib to a CardView class I tried this:
let nib = UINib(nibName: "CardView", bundle: nil).instantiateWithOwner(nil, options: nil).first as! CardView
But I end up with this error:
Could not cast value of type 'UIView' (0x10c058df8) to 'LazyFlashCards.CardView' (0x10934bb00).
So I'm guessing that I'm instantiating the XIB file wrongly but I don't know the "correct" way to do it
