Re: Subclassing NSWindowController in Swift
Re: Subclassing NSWindowController in Swift
- Subject: Re: Subclassing NSWindowController in Swift
- From: Quincey Morris <email@hidden>
- Date: Sun, 19 Oct 2014 09:14:36 +0000
On Oct 19, 2014, at 01:28 , Rick Mann <email@hidden> wrote:
>
>> you will need to declare it “convenience”.
>
> Tried that, too.
Ugh! Now you made me create a project to try it.
It looks like the problem is that ‘init’ is already a designated initializer, though not of NSWindowController. That means it’s neither inherited (which seems correct), nor overridable as a convenience initializer (which is conceivably a bug, since I don’t see that it can be invoked at all from the subclass of NSWindowController, so it may as well be invisible to it). Therefore, I’d be inclined to solve it by either:
— providing a factory method that directly invokes the existing convenience init that takes a “windowNibName” parameter, so that you don’t use the parameterless init at all, or
— (if I had other parameters to pass) declare a convenience init that has a different signature:
convenience init (somethingElse: SomeType) {
self.init(windowNibName: "abc”)
… do things with somethingElse …
}
or do the latter plus a factory method to invoke it.
Or maybe someone else has a better solution.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden