I want to save the enumeration state for a managed object in CoreData
enum ObjStatus: Int16 { case State1 = 0 case State2 = 1 case State3 = 3 } class StateFullManagedObject: NSManagedObject { @NSManaged var state: Int16 }
The final step is to convert the var StateFullManagedObject state to ObjStatus for direct comparison, which does not work for me. For example, I cannot use the == operator between an Int16 and an Int16 enumeration. The compile time error that I get is
Int16 does not convert to 'MirrorDisposition'
. See legend below:
var obj: StateFullManagedObject = // get the object if (obj.state == ObjStatus.State1) { // Int16 is not convertible to 'MirrorDisposition' }
How can I compare / assign between Int16 and enumeration?
swift core-data
kev Nov 13 '14 at 2:24 2014-11-13 02:24
source share