> > On 12 Jul 2014, at 10:05 pm, Trygve Inda <cocoa...@xericdesign.com> wrote: > >> ---someProperty (Custom NSObject) >> ------propertyA (NSNumber) >> ------propertyB (NSNumber) >> ------propertyC (NSNumber) >> >> Properties A, B and C use a binding to connect them to a user interface item >> with something like: >> >> Bind to MyObject with key path someProperty.propertyA > > > Just as a matter of interest, why do you decalre these subproperties as > NSNumber types? Is there a reason you can't just make them the native scalar > types they wrap (e.g. integer, float)? KVC/KVO automatically wraps scalar > values with NSNumber or NSValue to pass them around through bindings, so you > don't have to concern yourself with it. Usually, code is clearer if properties > are declared as the native types. If you make them NSNumbers, how will you > detect or prevent a value of the wrong type being passed? > > --Graham > > >
Is NSInteger treated the same way? This page does not mention it: https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/KeyVa lueCoding/Articles/DataTypes.html NSNumber just seem a bit more flexible since they can be added to dictionaries (such as in the userInfo of a Notification). T. _______________________________________________ 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