I'm attempting to use a custom uiview for a tinder-style card swipe library called Koloda, which requires that I pass in a uiview for each card in the stack. I'm attempting to use a custom uiview with relevant fields/info, and after thorough testing I've discovered that generating an instance of uinib is giving me a 'not key value coding-compliant' error, despite having all my outlet connections in order.
I've tried recreating all my IBOutlets, going as far as to just start over with a new xib file with new connections. When I drag a uiview onto a view controller in storyboard, and conform it to my custom type, it shows up no problem and I can manipulate its various properties as desired. It's only when instantiating the custom view that I get the error.
class VoteCard: UIView {
@IBOutlet var contentView: UIView!
@IBOutlet weak var proPicImg: UIImageView!
@IBOutlet weak var nameLbl: UILabel!
@IBOutlet weak var homeLbl: UILabel!
@IBOutlet weak var ratingLbl: UILabel!
override init(frame: CGRect) {
super.init(frame: frame)
commonInit()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
commonInit()
}
func commonInit() {
Bundle.main.loadNibNamed("VoteCard", owner: self, options: nil)
contentView.fixInView(self)
}
class func instanceOf() -> VoteCard {
return UINib(nibName: "VoteCard", bundle: nil).instantiate(withOwner: nil, options: nil).first! as! VoteCard
}
}
If all works correctly, my Koloda card stack should show my custom cards, however as of yet I can't get passed the generation of a new instance.