-
Notifications
You must be signed in to change notification settings - Fork 395
Using enums as types
Christopher Rogers edited this page Aug 26, 2015
·
6 revisions
If you want to use a enum
type for one of your scalar attribute (instead of using uint8_t
or any other scalar type internally used by CoreData):
In ObjC:
// MyEnum.h
typedef NS_ENUM(uint16_t, Gender) {
GenderMale,
GenderFemale
}
Or in Swift:
enum Gender : UInt16 {
case Male, Female
}
Add the additionalHeaderFileName
key in your Entity's UserInfo and give it that file name (MyEnum.h
) as value.
Add the attributeValueScalarType
key in your Attribute's userInfo and give it the enum name (Gender
) as value.
See also Core Data User Info Keys