• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSWindowController and designated initializer rules
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSWindowController and designated initializer rules


  • Subject: Re: NSWindowController and designated initializer rules
  • From: Quincey Morris <email@hidden>
  • Date: Tue, 24 Jun 2014 08:36:30 -0700

On Jun 24, 2014, at 07:55 , Sean McBride <email@hidden> wrote:

> I guess it's omission could be a bug, but assuming not, Sketch gets a compiler warning if you tag its own designated initializer (init) with NS_DESIGNATED_INITIALIZER, since it doesn't call one of super's designated initializers.

It doesn’t look like a bug per se, since the old NSWindowController pattern is grandfathered into the Swift world. However, tagging a subclass ‘init’ as designated will break it.

I believe you can solve it if you implement ‘initWithWindow:’ as a designated initializer in the subclass too (just calling super). In that case, your subclass will inherit ‘initWithWindowNibName:’ as a convenience initializer, so it can be called by your subclass ‘init’ — though I would assume only as ‘self initWithWindowNibName:’, not as ‘super initWithWindowNibName:’.

> I was trying not to mention 10.10 due to any NDA (though Apple seems more lax about it recently)

Nothing I said was under NDA, since all the information came from the Swift book and the WWDC videos, which are not under NDA this year. In fact, I haven’t downloaded 10.10 or Xcode 6 yet. Since the answer to your question isn’t under NDA, I think we can assume the question was legal too. :)

_______________________________________________

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


  • Follow-Ups:
    • Re: NSWindowController and designated initializer rules
      • From: Roland King <email@hidden>
References: 
 >NSWindowController and designated initializer rules (From: Sean McBride <email@hidden>)
 >Re: NSWindowController and designated initializer rules (From: Graham Cox <email@hidden>)
 >Re: NSWindowController and designated initializer rules (From: Quincey Morris <email@hidden>)
 >Re: NSWindowController and designated initializer rules (From: Sean McBride <email@hidden>)

  • Prev by Date: Re: NSWindowController and designated initializer rules
  • Next by Date: UIBarButtonItem message to first responder?
  • Previous by thread: Re: NSWindowController and designated initializer rules
  • Next by thread: Re: NSWindowController and designated initializer rules
  • Index(es):
    • Date
    • Thread