I want to create a UIView by code and I need to know 4 variables to draw this UIView.
But I can't initialize this subclass.
Here is my code:
class CardView: UIView, UIGestureRecognizerDelegate{
private(set) var character: Int
private(set) var numberOfCharacters: Int
private(set) var shading: Int
private(set) var color: Int
private(set) var identifier: Int
init(frame: CGRect, card: Card) {
self.character = card.character
self.numberOfCharacters = card.numberOfCharacters
self.color = card.color
self.shading = card.shading
self.identifier = card.identifier
super.init(frame: frame)
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder) //Error: Property 'self.character' not initialized at super.init call
}
}
Did I miss anything?