WIP: reorganization of keypath utilities (in prep for @propertyWrappers)

This commit is contained in:
John Estropia
2019-07-09 14:50:23 +09:00
parent 67bb9340c7
commit ed3d21db77
14 changed files with 523 additions and 314 deletions

View File

@@ -153,9 +153,27 @@ extension DynamicObject where Self: CoreStoreObject {
)
return PartialObject<Self>(self.rawObject!)
}
// MARK: Internal
internal static var meta: Self {
return self.init(asMeta: ())
let key = ObjectIdentifier(self)
if case let meta as Self = Static.metaCache[key] {
return meta
}
let meta = self.init(asMeta: ())
Static.metaCache[key] = meta
return meta
}
}
// MARK: - Static
fileprivate enum Static {
fileprivate static var metaCache: [ObjectIdentifier: Any] = [:]
}