Cocoa Bindings misery

I’m really starting to think twice about Cocoa Bindings.  It’s touted as the ‘never write glue code again’ solution, making it seem like you’ll never spend time writing boring code again.  YAY.

Except they forget to mention that you’ll spend just as much time trying to debug a black box.  -.-  OR writing code that makes your application ‘fit into’ their way of doing things.  So if you don’t fully understand the technology, you’re spending all of your time trying to figure out WHY something won’t work.  It’s really kind of a pain in the a**.  I feel like I’m a first grader who got thrown into 5th grade math class.   Missing big pieces of the big picture and hoping you can fumble or fake your way through it.  Cocoa Bindings will punish you for that.

Can anyone tell me how you can set breakpoints on specific setters on Core Data generated accessors?  It would be nice to inspect the properties of specific data models at runtime.

I am binding a NSTableView (well, it’s individual columns), to an array controller who elements (arrangedObjects) are of type ‘TimeBlock’.  Now a TimeBlock is defined in the Core Data model, and it has a few NSNumber properties, and then a Transformable Property to type TimeRange (which I successfully convert to and from NSData with a NSValueTransformer subclass… as the docs say you should).

A TimeRange object has 2 NSNumbers for min and max amount of time something should take.  I want to bind either of these to a NSTextCell’s value.  So I bind the column to arrangedObjects.timeRange.max  (and even use a NSValueTransformer  to ensure strings are numbers and vice versa) and provide a NSNumberFormatter object to the NSTextCell.

But the Time Range object shows itself to be nil in the UI.  I have no idea what’s going wrong.  I set a value.  It ‘sticks’.  I save the models.  I restart the app.  None of the values have been committed.  I can’t debug it.  (Can I ?)

Teaching oneself such a technology is maybe not the best idea.  It’s like it’s a constant two steps forward, one step back way of learning, and it’s kind of annoying.

Rant over.  If and when I get this figured out I’m gonna write a tutorial – in plain English – how one needs to visualize how these things work.  This is just way too annoying, and the documentation is very very boring.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s