On Nov 2, 2015, at 12:51 , Richard Charles <rcharles...@gmail.com> wrote:
> 
> So that is interesting that NSControl will work with a double. My custom 
> binding works with double values. But after doing a little searching on the 
> web it appears that value transformers do not work with double values unless 
> you change the double into a NSNumber.

That’s not quite how it is. NSControl doesn’t work with a double either — its 
underlying value is always an object (‘objectValue’), and ‘doubleValue’ 
converts the object back to a scalar value.

What actually happens is that KVC, which is what bindings use to fetch values 
for e.g. controls, has built in behavior to convert certain scalar properties 
to objects. So you should write the value transformer to take and produce a 
NSNumber object, and KVC should handle all the necessary conversions for you.

_______________________________________________

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

Reply via email to