• 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
Subclassing NSView in Yosemite?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Subclassing NSView in Yosemite?


  • Subject: Subclassing NSView in Yosemite?
  • From: Alex Hall <email@hidden>
  • Date: Thu, 06 Nov 2014 09:29:43 -0500

Hello list,
I've subclassed NSView before, doing all my setup in init withFrame, and it works fine. Now, though, I'm using Swift in Xcode 6.1 to build a project against 10.10, and I'm getting an error that I need to implement initWithCoder:NSCoder.

The problem is that the documentation says nothing about this, so I'm not sure which initializer is called when. That is, where do I put all my setup to ensure it gets called? I'd rather not do it twice, since I'm afraid one or the other initializer could get called when I don't expect it and set things up as though the app had just launched.

I can't find much of anything on this initWithCoder requirement, so I'm at a loss as to where to set things up, and even what to pass the initializer for an NSCoder. I'd appreciate any links or other resources, or just explanations, anyone can provide. Thanks. Oh, here's the page I'm looking at, among many others on Google:
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/index.html#//apple_ref/doc/uid/20000014-SW10

--
Have a great day,
Alex Hall
email@hidden

_______________________________________________

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: Subclassing NSView in Yosemite?
      • From: Kyle Sluder <email@hidden>
    • Re: Subclassing NSView in Yosemite?
      • From: David Duncan <email@hidden>
  • Prev by Date: best way to implement unlock features in app
  • Next by Date: Re: best way to implement unlock features in app
  • Previous by thread: Re: best way to implement unlock features in app
  • Next by thread: Re: Subclassing NSView in Yosemite?
  • Index(es):
    • Date
    • Thread