Re: KVG generic enough?
Re: KVG generic enough?
- Subject: Re: KVG generic enough?
- From: Jens Alfke <email@hidden>
- Date: Wed, 18 Jul 2012 17:52:39 -0700
On Jul 18, 2012, at 4:46 PM, William Squires <email@hidden> wrote:
> Okay, but the problem with wrapped scalars is determining what went in (int, float, char, BOOL) once you get it out (presumably as an NSNumber)? I suppose one way would be to define a 'type' dictionary in the object whose properties I'm interested in, but this would create extra complexity when creating the low-level model objects.
Just ask for what you want, and NSNumber will return it as that type. If you want a float, call -floatValue. If you want an int, call -intValue.
If you want to know what the actual type stored was, check the .objCType property, which is a type-encoding string of the sort created by @encode. These are fairly easy to parse. If you need to access that, though, it's fairly likely that you're doing something wrong...
—Jens
_______________________________________________
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