0

In my model class there is property:

@property (readwrite, nonatomic) NSString* prop;

...

-(NSString*) prop
{ return someExternalObject.stringProp;}
-(void) setProp: (NSString*) str
{ someExternalObject.stringProp = str;}

At some moment someExternalObject.stringProp changes and I need to invoke updating of Cocoa element that is binded to prop. How to do it?

PS: I definitely can't bind Cocoa element directly to someExternalObject.

brigadir
  • 6,874
  • 6
  • 46
  • 81
  • Can your model class get notified when someExternalObject.stringProp changes? The binding won't propagate the change unless the model object knows that it's there's been a change. One way to approach this is to have prop actually be a local property on your model class, and when someExternalObject.stringProp is changed, have it call [yourModelClass setProp:newValue]. This should trigger the cocoa bindings machinery. – Pete Clark Jan 14 '13 at 15:24
  • I do similar thing at current moment: `self.prop = self.prop` in `refresh` method. But I would be happy to look at more automated solution. – brigadir Jan 15 '13 at 09:02

0 Answers0