JohnBigs
JohnBigs

Reputation: 2811

Should I check the “Use scalar properties for primitive data types” when generating a new NSManagedObject subclass from my model file?

I created a project using Core Data, and in the .model file I created an entity called Targets.

I added these two entity attributes:

content (String)
targetID (Integer 32)

When I generate the NSManagedObject subclass Xcode asks me:

Use scalar properties for primitive data types?

Should I check this box when generating a new NSManagedObject subclass from my model file?

Upvotes: 11

Views: 5104

Answers (2)

DawnSong
DawnSong

Reputation: 5152

If checking the option, the default value for Number type what you get will be zero, but nil is more reasonable. So, I don't think you should check the box.

Upvotes: 3

0x141E
0x141E

Reputation: 12753

If the box is checked, Xcode will generate scalar types (e.g., int, float, double) for those attributes. If not checked, the attributes will be NSNumbers.

Upvotes: 16

Related Questions