> On Jun 16, 2017, at 3:48 PM, Charles Srstka <cocoa...@charlessoft.com> wrote: > >> On Jun 16, 2017, at 3:27 PM, Jerome Krinock <je...@ieee.org> wrote: >> >>> On 2017 Jun 16, at 10:35, Quincey Morris >>> <quinceymor...@rivergatesoftware.com >>> <mailto:quinceymor...@rivergatesoftware.com>> wrote: >>> >>> it takes additional custom code (like in the joystick example) to implement >>> the other direction. At least, that’s what I’ve been saying for years, >>> though I don’t think I’ve ever found a developer who believes me. >> >> I believe you. I think it was on your advice I've done this: >> >> foo.bind("xxx", to: bar, ... ); >> bar.bind("yyy", to: foo, ... ); >> >> It works, but only in both directions with both statements. > > This is incorrect. The recommended way to implement a two-way binding is to > override .bind(…) on the target object and set up KVO observations there. See > this page in the docs: > > https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CocoaBindings/Concepts/HowDoBindingsWork.html > > <https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CocoaBindings/Concepts/HowDoBindingsWork.html> > > Charles
For more information (and a ton of sample code), see mmalc’s old page on the subject. Sadly, it fell off the Web when MobileMe shut down, but archive.org <http://archive.org/> still seems to have most of the info, including the project .zip files: http://web.archive.org/web/20120620180050/http://homepage.mac.com:80/mmalc/CocoaExamples/controllers.html <http://web.archive.org/web/20120620180050/http://homepage.mac.com:80/mmalc/CocoaExamples/controllers.html> Charles _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com