-
Notifications
You must be signed in to change notification settings - Fork 395
Using enums as types
Tom Harrington edited this page Apr 27, 2019
·
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, EventType) {
Party,
Concert,
TradeShow
};
Or in Swift:
@objc enum EventType : UInt16 {
case party
case concert
case tradeShow
}
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 (EventType
) as value.
See also Core Data User Info Keys