views:

572

answers:

2

Can anyone link to or list out the object types that the iphone sdk has built in? For the moment I'm just looking for the simple data types. I'm looking for variable types that are accepted in @interface definitions and also can be made into properties.

For example: NSNumber is for integers, right? BOOL is for booleans.

What are the rest of the simple data types I can use?

+1  A: 

The documentation is your friend, depending on your current skills you should also read the Objective-c 2.0 Introduction, read the Getting Started documents or look at the sample code. For C/Objective-C you have the basic datatypes you would expect int, float, double, char. NSArray and NSDictionary are pretty important for storing things, their changeable counterparts NSMutableArray and NSMutableDictionary are useful. NSNumber is a wrapper so your basic types can be used where objects are used (to put them in an NSArray for example)

Harald Scheirich
+1  A: 

I would like to answer the question about what can go into a @interface and a @property definition.

Short answer; any C type, plus some Objective-C additions:

  • SEL & IMP - Method selectors, and method implementation pointer.
  • id - The object instance pointer.
  • Class & Protocol - The meta class, and protocol instance pointers.

These have special meaning, anything else is just a sub-type of these.

For the access modifiers to @property:

  • assign - Any type.
  • retain - Only an id type, conforming to the NSObject protocol.
  • copy - Only an id type, conforming to the NSCopying protocol.
PeyloW
Wow. That sort of makes my question unnecessary. :) Now I understand it a bit more. I just need to make sure I don't use retain with non NSObject types.
Neo42