mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-13 05:45:32 +01:00
add Field.Relationship dynamicMemberLookups
This commit is contained in:
@@ -209,6 +209,25 @@ extension ObjectSnapshot where O: CoreStoreObject {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the value for the property identified by a given key.
|
||||
*/
|
||||
public subscript<OBase, V>(dynamicMember member: KeyPath<O, FieldContainer<OBase>.Relationship<V>>) -> V.PublishedType {
|
||||
|
||||
get {
|
||||
|
||||
let key = String(keyPath: member)
|
||||
let context = self.context
|
||||
let snapshotValue = self.values[key] as! V.SnapshotValueType
|
||||
return V.cs_toPublishedType(from: snapshotValue, in: context)
|
||||
}
|
||||
set {
|
||||
|
||||
let key = String(keyPath: member)
|
||||
self.values[key] = V.cs_toSnapshotType(from: newValue)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the value for the property identified by a given key.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user