I'm wondering how I should deal with overriding "designated initailizers". I really have no clue about the part "self = [super...]. KeyboardView is a subclass of NSView.

@implementation KeyboardView

- (id)initWithFrame:(NSRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code here.
    return self;

This is what I came up with so far:

override KeyboardView initWithFrame(NSRect frame) [initWithFrame:] {
    //my stuff
    return cast(KeyboardView) super.initWithFrame(frame) ;

This compiles and does not throw any runtime error, but it's a bit against the idea, because in Objective-C the idea is to first call the super class, then adapt and override what is necessary. When calling super in the very end, this of course is no longer guaranteed.

Reply via email to