1

Very similar question to Best way to implement Enums with Core Data

What is the best way to bind Core Data entities to enum values so that I am able to assign a type property to the entity? In other words, I have an entity called Item with an itemType property that I want to be bound to an enum, what is the best way of going about this in Swift?

Community
  • 1
  • 1
Wizard of Kneup
  • 1,863
  • 1
  • 18
  • 35
  • possible duplicate of [Best way to implement Enums with Core Data](http://stackoverflow.com/questions/1624297/best-way-to-implement-enums-with-core-data) – Abizern Dec 26 '14 at 11:24
  • 1
    You do if the same way as any of those suggestions. It's not really good gorm to just ask people to translate objc code to Swift for you. – Abizern Dec 26 '14 at 11:25
  • 1
    Abizern, see my first answer. No, this is not a duplicate question. The ObjC solutions cannot easily translated. Please review. – Wizard of Kneup Dec 29 '14 at 19:48

1 Answers1

0

So far, this is my best approach. I still use the ObjC enum definition, as suggested in Daniel Eggert's answer to the same ObjC question as the Swift Enum doesn't seem to be backward compatible to ObjC. Hence, I added it to my bridge header.

Wizard of Kneup
  • 1,863
  • 1
  • 18
  • 35