Re: Cocoa Bindings - many people using them?
Re: Cocoa Bindings - many people using them?
- Subject: Re: Cocoa Bindings - many people using them?
- From: Steve Sims <email@hidden>
- Date: Fri, 21 May 2004 16:18:01 -0400
On 20 May 2004, at 21:56, Peter.Teeson wrote:
I am in the design phase of a new Cocoa Document app and decided to
read up on Cocoa Bindings.
Have there been many people using that capability?
I made the decision to use them in my own app having written a
collection of prototype apps that used a non-bindings approach, and one
that did use bindings. Whilst there's an obvious compatibility
trade-off, as bindings are 10.3+ only I felt it was worth it in the
savings I gained.
How well does it deal with your issues?
Very well for most purposes.
There's a few slightly limitations though. Whilst you can put a list
of parameters for "enabled" or "hidden" I believe (if memory serves)
this list is logically ANDed - i would have liked to be able to enable
on one condition OR another. There's probably a way around this
limitation though using value transformers. Bindings also (for text
fields at least) don't play nice with validate methods - the validate
methods get called as they should and you can change the values but
they don't automatically get updated in the UI. This is a bug, but you
can work around it by delaying calls to will... and
didChangeValueForKey.
Overall I'm very happy indeed with bindings. The technology it builds
on, Key Value Observing (KVO) is also very handy indeed and I also make
use of that in my UI and underlying data model.
Do you still have to resrot to target/action, delegate approachs as
well?
Whether you need to use these approaches depends on what you're trying
to accomplish. In my app I still need to have a delegate for my main
window and NSApp, but they are used for control purposes outside of the
direct scope of my data model. I also use target/actions for things
like menu items and just one button in my main UI.
Remember though, the main purpose of bindings is to hook your UI up to
your underlying data model. For that purpose it's very good indeed - I
really have only one action link in my UI, yet that UI collects a
couple of dozen parameters and has elements that disable themselves
when they're not appropriate to be used, all thanks to bindings. It
saved me a hell of a lot of coding.
I would like to hear user's experiences with the technology.
I had an initial hurdle to get over in understanding just how bindings
work, but that hurdle was pretty easy. Well worth the effort.
I hope this helps!
Steve
_______________________________________________
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.