Which Swift types can be represented in Objective-C?
You cannot assign arbitrary types to Core Data properties because the accessor methods are created dynamically at runtime. If you create an Objective-Cmanaged object subclass in Xcode then you will see the proper data types usedby Core Data, e.g.
NSNumber
for Boolean, Integer, Float and Double attributes,NSString
for String attributes,NSSet
for (unordered) to-many relationships.
You have to choose the same data type in Swift.
Theoretically, scalar accessors for primitive data types should work as well,but there seems to be a problem in the current Swift version, compareHow to use Core Data Integer 64 with Swift Int64? or EXC_BAD_ACCESS error when trying to change Bool property.