• 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: [self init] vs. [super init] in initWithCoder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [self init] vs. [super init] in initWithCoder


  • Subject: Re: [self init] vs. [super init] in initWithCoder
  • From: John McLaughlin <email@hidden>
  • Date: Fri, 18 Aug 2006 12:53:36 -0700

Hi All,

The consensus seems to be to have a private init function ('setDefaults') and then all of your inits' can call that. Seems a reasonable approach that is certainly maintanable but a large part of me still wonders that unless you need to call the parents initWithCoder or unless you are doing something in your init that is painful (time or resource wise) the most elegant solution would still be to call [self init] first -- It guarantees an object's starting point is the same whether loaded from a coder or instantiated brand new and it really (again, to me) has a certain elegance to it.

Anyway again thanks for the response.

-John

On Aug 17, 2006, at 8:42 PM, Ricky Sharp wrote:


Finally, for other non-archived attributes, or other things that need to be set up, why not create a separate method (e.g. setDefaults) and call it from both initWithCoder and your various other init methods?

John McLaughlin http://www.loghound.com email@hidden



Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: [self init] vs. [super init] in initWithCoder
      • From: glenn andreas <email@hidden>
References: 
 >[self init] vs. [super init] in initWithCoder (From: John McLaughlin <email@hidden>)
 >Re: [self init] vs. [super init] in initWithCoder (From: Ricky Sharp <email@hidden>)

  • Prev by Date: Re: What's the fastest way to get icons for file/folders?
  • Next by Date: Re: [self init] vs. [super init] in initWithCoder
  • Previous by thread: Re: [self init] vs. [super init] in initWithCoder
  • Next by thread: Re: [self init] vs. [super init] in initWithCoder
  • Index(es):
    • Date
    • Thread