• 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: Properties vs Instance Variables
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Properties vs Instance Variables


  • Subject: Re: Properties vs Instance Variables
  • From: William Squires <email@hidden>
  • Date: Sat, 14 May 2011 01:23:02 -0500

On Apr 26, 2011, at 10:28 PM, Guy Steven wrote:

> I am currently learning objective c and cocoa
>
> I believe I understand the difference between properties and instance
> variables, and the effect of using properties as opposed to instance
> variables viz a viz KVO and memory management.
>
> What I can't understand is why you would access instance variables directly
> within a class. My quess is speed. Is there any other reason?
>
Because there are times when you need to set the values of a bunch of ivars without triggering an observation of their values by some other object, such as within the 'init' method of your class, or if you're handling the 'observation' manually, through NSNotificationCenter.

> And related to this, why give instance variables a name different to the
> name of the property.
>
> Again, I suspect it may be a matter of style, but would like to know if
> there are cases where it is a necessity.
> _______________________________________________
>
> 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

_______________________________________________

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

  • Prev by Date: Re: Can't create temporary file
  • Next by Date: Re: Scroll view within scroll view blocks scrolling
  • Previous by thread: Re: @property IBOutlet
  • Next by thread: NSPostWhenIdle not doing its job?
  • Index(es):
    • Date
    • Thread