cocoa - How to initialize NSTableRowView subclass? -
the compiler crashses on line 3 , cant find information on nstablerowview initializers anywhere
class itemrowview: nstablerowview { convenience override init(frame: nsrect) { self.init(frame: frame) // exc bad access self.draggingdestinationfeedbackstyle = nstableviewdraggingdestinationfeedbackstyle.none }
first, init( frame: nsrect )
is designated initializer, keyword convenience
wrong in place. meant call super
initializer own method recursively. @ last you'll need implement required initializer init?(coder: nscoder)
the following code should going:
class itemrowview: nstablerowview { override init(frame: nsrect) { super.init(frame: frame) // super - not self self.draggingdestinationfeedbackstyle = nstableviewdraggingdestinationfeedbackstyle.none } required init?(coder: nscoder) { // write useful here, or leave default implementation fatalerror("init(coder:) has not been implemented") } }
Comments
Post a Comment