• 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: Arghh bindings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Arghh bindings


  • Subject: Re: Arghh bindings
  • From: Quincey Morris <email@hidden>
  • Date: Mon, 10 Sep 2012 19:23:54 -0700

On Sep 10, 2012, at 18:48 , Rick Mann <email@hidden> wrote:

> The docs say you can implement either insertObject: or insert<Key>. I figured it was smart enough to handle the plural-vs-singular change, otherwise it's grammatically awkward.

Well, you were wrong about that. :)

The intention is that to-many properties should have plural names, and the accessor name convention reflects this:

	insertObject:inConnectionsAtIndex:
	insertConnections:atIndexes:

Both are grammatically correct if the property name is correct. There is no 'insertConnection:atIndex:' and nothing in the documentation to support the idea.

> To this day I'm a little puzzled why a simple NSMutable property needs all the extra scaffolding. It really seems like you should get this behavior for free, and only need to implement those methods when the thing backing it isn't a standard collection.

It doesn't need "all the extra scaffolding". KVC will peer quite happily into your instance variables by default. What you don't get for free, in that case, is KVO compliance for the property. The purpose of providing explicit accessors is therefore twofold:

1. It avoids letting KVC introspect your ivars, which is a horrible hack.

2. It gives you automatic KVO compliance.


_______________________________________________

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: Arghh bindings
      • From: Rick Mann <email@hidden>
    • Re: Arghh bindings
      • From: Charles Srstka <email@hidden>
References: 
 >Arghh bindings (From: Rick Mann <email@hidden>)
 >Re: Arghh bindings (From: Graham Cox <email@hidden>)
 >Re: Arghh bindings (From: Rick Mann <email@hidden>)

  • Prev by Date: Re: binding an array controller to columns in an NSTableView
  • Next by Date: Re: Arghh bindings
  • Previous by thread: Re: Arghh bindings
  • Next by thread: Re: Arghh bindings
  • Index(es):
    • Date
    • Thread