• 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: Problem using dictionary
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem using dictionary


  • Subject: Re: Problem using dictionary
  • From: Abhi Beckert <email@hidden>
  • Date: Tue, 19 Oct 2010 13:52:02 +1000

On 2010-10-09, at 6:14 AM, Remco Poelstra wrote:

> That seems reasonable, but makes the documentation harder to read. In the old days where I used Delphi, the inherited methods were all shown as such and it gives a direct overview of what is available. Especially in this case, where the valueForKey* methods are neither mentioned in the NSObject docs, not that NSObject followsNSKeyValueCoding. Well, maybe Apple adds such functionality someday to their doc browser.


[NSObject valueForKey:] has nothing to do with dictionaries. It's an internal API feature that's used throughout the framework. The foo.bar syntax is essentially an alias for [foo valueForKey:@"bar"]. Understanding exactly how this method works is one of the first things you need to learn as a cocoa programmer. NSDictionary wouldn't even document valueForKey: at all, except that it changes the behaviour slightly.

You can't document every message NSDictionary will respond to, most have nothing to do with dictionaries. Eg. would you expect +alloc to be documented? What about -performSelectorOnMainThread:withObject:waitUntilDone:? Both can be used on an NSDictionary, and neither are mentioned in the documentation.

You just need to get used to looking up parent classes and categories. Similarly, NSMutableDictionary doesn't document valueForKey: or count, even though those are probably the most important two methods in an NSMutableDictionary object. They are implemented in a parent class, and won't me listed in the NSMutableDictionary class reference.

The NSDictionary Class Reference is exactly that — a reference. If you want an introduction of how to use it, you must read "Collections Programming Topics", which is linked in the sidebar of NSDictionary's reference page.

- Abhi

_______________________________________________

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: Problem using dictionary
      • From: Quincey Morris <email@hidden>
References: 
 >Problem using dictionary (From: Remco Poelstra <email@hidden>)
 >Re: Problem using dictionary (From: Remco Poelstra <email@hidden>)
 >Re: Problem using dictionary (From: Quincey Morris <email@hidden>)
 >Re: Problem using dictionary (From: Remco Poelstra <email@hidden>)

  • Prev by Date: Tracing an iPhone application/framework
  • Next by Date: Re: Unarchiving cells out of order.
  • Previous by thread: Re: Problem using dictionary
  • Next by thread: Re: Problem using dictionary
  • Index(es):
    • Date
    • Thread