• 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: Are Bindings Redundant?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Are Bindings Redundant?


  • Subject: Re: Are Bindings Redundant?
  • From: Allan Odgaard <email@hidden>
  • Date: Sat, 5 Jun 2004 06:37:00 +0200

On 5. Jun 2004, at 5:39, James DiPalma wrote:

ehm... like bind things together? observe values? use array operators? etc.
Bindings themselves do not observe values nor do they use array operators.

The essence is probably the bind:toObject:withKeyPath:options: selector documented in NSKeyValueBindingCreation:

Creates a relationship between the receivers binding and
the property of observableController specified by keyPath

So we have keyPath (where array operators is just a special case of key paths) and we have 'observableController', which hints that key-value observing will be used.

But argue all you want :) I was not trying to provide a definition above, merely asking what the OP had in mind... and I really do think that bindings is just an umbrella term, as hinted e.g. by this quote:

Cocoa Bindings provides extensible controllers, protocols
for models and views to adopt, and additions to classes
in Foundation and the Application Kit [...]

Bindings are not associations; [...]

And in this context, associations is what?

bindings require objects like views and cells to implement behavior like observing data [...]

Maybe according to the documentation ;)

% gcc -x objective-c -framework Cocoa - <<EOF
#import <Cocoa/Cocoa.h>

@interface foo : NSObject
{ NSString* value; }
@end

@implementation foo
@end

int main ()
{
[NSAutoreleasePool new];

foo* obj1 = [foo new];
foo* obj2 = [foo new];

// uses KVO for obj2.value and KVC for obj1.value
[obj1 bind:@"value" toObject:obj2 withKeyPath:@"value" options:nil];

[obj2 setValue:@"wow!" forKey:@"value"];
NSLog(@"%@", [obj1 valueForKey:@"value"]);

return 0;
}
EOF
% ./a.out
2004-06-05 06:26:03.636 a.out[2589] wow!
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Are Bindings Redundant? (From: Hasan Diwan <email@hidden>)
 >Re: Are Bindings Redundant? (From: Ondra Cada <email@hidden>)
 >Re: Are Bindings Redundant? (From: "Mike R. Manzano" <email@hidden>)
 >Re: Are Bindings Redundant? (From: Ondra Cada <email@hidden>)
 >Re: Are Bindings Redundant? (From: Hasan Diwan <email@hidden>)
 >Re: Are Bindings Redundant? (From: Allan Odgaard <email@hidden>)
 >Re: Are Bindings Redundant? (From: James DiPalma <email@hidden>)

  • Prev by Date: Re: Representing UTC time in a readable format
  • Next by Date: Drawing a view and its subviews to an NSImage
  • Previous by thread: Re: Are Bindings Redundant?
  • Next by thread: Re: Are Bindings Redundant?
  • Index(es):
    • Date
    • Thread