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?
From the Xcode menu bar, choose Editor > Create NSManagedObject Subclass. Select your data model, then the appropriate entity, and choose where to save the files. Xcode places both a class and a properties file into your project.
Scalar TypesCore Data has support for many common data types like integers, floats, booleans, and so on. However, by default, the data model editor generates these attributes as NSNumber properties in the managed object subclasses.
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 NSNumber
s.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With