extra extra type safety for attributes (fetching and importing)

This commit is contained in:
John Estropia
2017-02-17 14:13:16 +09:00
parent d2fd03c1f0
commit 9d5e04854a
10 changed files with 744 additions and 637 deletions

View File

@@ -59,7 +59,7 @@ public protocol ImportableUniqueObject: ImportableObject {
/**
The data type for the entity's unique ID attribute
*/
associatedtype UniqueIDType: CoreStoreSupportedAttributeType
associatedtype UniqueIDType: CoreStoreUniqueIDAttributeType
/**
The keyPath to the entity's unique ID attribute
@@ -192,14 +192,14 @@ public extension ImportableUniqueObject where Self: NSManagedObject {
get {
return UniqueIDType.cs_fromNativeType(
self.value(forKey: type(of: self).uniqueIDKeyPath) as! UniqueIDType.CoreStoreNativeType
return UniqueIDType.cs_fromUniqueIDNativeType(
self.value(forKey: type(of: self).uniqueIDKeyPath) as! UniqueIDType.NativeTypeForUniqueID
)!
}
set {
self.setValue(
newValue.cs_toNativeType(),
newValue.cs_toUniqueIDNativeType(),
forKey: type(of: self).uniqueIDKeyPath
)
}