Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Cocoa bindings problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa bindings problem



On 10/30/09 1:34 PM, Kyle Sluder said:

>> Instead of a value transformer, in your NSManagedObject subclass add a
>> new method called 'timelessDate' which returns a modified version of
>> your 'date' attribute.  Then bind your table to 'timelessDate' instead
>> of 'date'.  Also use keyPathsForValuesAffectingValueForKey to indicate
>> that 'timelessDate' depends on 'date'.
>
>You could also model this as a transient property.

Yup.  Yet I've never been too clear on what the pros and cons of these
two approaches are.  In seems in the OP's case, the user would never
want to set this 'timelessDate' and so its really a real-only derived
attribute.  I *think* that in such cases, the approach I described is
better.  Also, transient properties participate in undo/redo, so I worry
that strange things could happen there.  In general, it will also depend
how expensive it is to construct the derived property.  Dates are fairly
lightweight, so I doubt it matters here.

--
____________________________________________________________
Sean McBride, B. Eng                 email@hidden
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

References: 
 >Cocoa bindings problem (From: Squ Aire <email@hidden>)
 >RE: Cocoa bindings problem (From: Squ Aire <email@hidden>)
 >Re: Cocoa bindings problem (From: "Sean McBride" <email@hidden>)
 >Re: Cocoa bindings problem (From: Kyle Sluder <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.