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

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

No files matched your search

+20 -2
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] = [:]
}