• 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: whether to use core data...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: whether to use core data...


  • Subject: Re: whether to use core data...
  • From: Mike Abdullah <email@hidden>
  • Date: Sat, 3 Oct 2009 20:31:02 +0100


On 3 Oct 2009, at 20:20, Colin Howarth wrote:

OK, skipping the melodrama, there's something wrong with the Apple documentation,
but I can't quite put my finger on it.


The Perl man pages on nested data structures, say a dictionary containing arrays containing
other dictionaries which are actually representing objects, I find perfectly clear, for example.
And I did the first time I read it.


Take the Key-Value Coding Programming Guide which describes the NSKeyValueCoding informal protocol which
defines a mechanism allowing applications to access the properties of an object indirectly
by name (or key), rather than directly through invocation of an accessor method or as instance variables.


Translation: You'll find lots of useful things can happen if you access your instance variables
(e.g. the variable bar of the instance foo) like this: baz = foo.bar; foo.bar = baz; which is just
shorthand for baz = [foo bar]; and [foo setBar: baz]; . Other parts of your code can access bar simply
by knowing the string @"bar".


Actually, that's not a translation, it's more or less (less rather than more, I admit) the entire Key-Value
Coding Programming Guide. At least, it's enough to get you going.

Well for a start your translation is wrong. Being able to do this:

baz = foo.bar;
foo.bar = baz;

is an Objective-C 2.0 feature – Dot Notation. It is completely orthogonal to Key-Value Coding.

Dot Notation works by the compiler figuring out which method calls the dots correspond to.

Key-Value Coding happens at run-time where the object receives a - valueForKey: or -setValue:forKey: message and then decides how to handle it based upon the key.

_______________________________________________

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: whether to use core data...
      • From: Colin Howarth <email@hidden>
References: 
 >whether to use core data... (From: Colin Howarth <email@hidden>)
 >Re: whether to use core data... (From: Sherm Pendley <email@hidden>)
 >Re: whether to use core data... (From: Colin Howarth <email@hidden>)

  • Prev by Date: Auto Install Login Item
  • Next by Date: Re: Auto Install Login Item
  • Previous by thread: Re: whether to use core data...
  • Next by thread: Re: whether to use core data...
  • Index(es):
    • Date
    • Thread