I am creating a subclass of NSView.
Following is my code from playground
class MyTableCell :NSView {
let firstName : String
init(name: String) {
firstName = name
super.init()
}
required init?(coder: NSCoder) {
super.init(coder: coder) <-- ERROR: firstName not initialised
}
}
let myName = "Test-Name"
var cell = MyTableCell(name: myName)
How do I get rid of error which requires firstName to initialised in init(coder).
I wont be making any views of type MyTableCell from IB.
(I agree as per swift design, one is required to initialise all the constants before super class initialiser is called. But is there any way out here ? Have I made any design mistake ?)