• 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: Core Data in a framework ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data in a framework ?


  • Subject: Re: Core Data in a framework ?
  • From: Quincey Morris <email@hidden>
  • Date: Wed, 17 Sep 2008 14:55:30 -0700

On Sep 17, 2008, at 14:24, dreamcat7 wrote:

NSMutableArray* dates;
NSMutableArray* emails;

[self bind:@"dates" toObject:itemsController withKeyPath:@"arrangedObjects.date" options:nil];
[self bind:@"emails" toObject:itemsController withKeyPath:@"arrangedObjects.email" options:nil];


Why is a binding to arrayController.arrangedObjects.itemKey only a 1- way binding?
Can i bind to the above keypath somehow bidirectionally ?

This has been discussed on this list several times in the last couple of months.


The short answer is that 'bind:toObject:withKeyPath:options:' doesn't create a binding. In particular, the first parameter (where you have @"dates" or @"emails") is not a property key but a binding name. You need to define a binding of that name before you can use 'bind:toObject:withKeyPath:options:'.

'bind:toObject:withKeyPath:options:' is actually a method in the NSKeyValueBindingCreation informal protocol, so it's really something you may implement when defining a new binding, not something you override.

The confusing part is that NSObject provides a default implementation of this method, and if you use it with a property key as the first parameter, you'll get what appears to be a "1-way binding".

The other confusing part is that "creating" a binding is ambiguous. Sometimes it's used to mean "exposing" a binding -- defining the set of behaviors that implement a binding of a certain name. Other times it's used to mean "establishing" a binding -- using a defined binding of a given name to link two specific objects.

The only documentation I know about for defining new bindings is:

	http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/Concepts/HowDoBindingsWork.html

but it's probably not worth doing unless you want to expose the new bindings as something reusable in IB.


_______________________________________________

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


References: 
 >Binding to an NSArrayController however binding is 1-way only. (From: dreamcat7 <email@hidden>)
 >Re: Core Data in a framework ? (From: dreamcat7 <email@hidden>)

  • Prev by Date: Re: NSApplication subclass crashes on 10.3 with Xcode 3
  • Next by Date: CATextLayer and attributed strings
  • Previous by thread: Re: Core Data in a framework ?
  • Next by thread: Re: Core Data in a framework ?
  • Index(es):
    • Date
    • Thread