• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: KVG generic enough?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >KVG generic enough? (From: William Squires <email@hidden>)
 >Re: KVG generic enough? (From: Marco Tabini <email@hidden>)
 >Re: KVG generic enough? (From: William Squires <email@hidden>)

  • Prev by Date: Re: NSArrayController not rearranging correctly
  • Next by Date: Re: Sizing NSTableView to data
  • Previous by thread: Re: KVG generic enough?
  • Next by thread: Re: KVG generic enough?
  • Index(es):
    • Date
    • Thread