mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-18 15:33:54 +01:00
WIP: SwiftUI utils
This commit is contained in:
@@ -67,6 +67,11 @@ public protocol ObjectRepresentation {
|
||||
A thread-safe `struct` that is a full-copy of the object's properties
|
||||
*/
|
||||
func asSnapshot(in transaction: BaseDataTransaction) -> ObjectSnapshot<ObjectType>?
|
||||
|
||||
/**
|
||||
Used internally by CoreStore. Do not call directly.
|
||||
*/
|
||||
func cs_dataStack() -> DataStack?
|
||||
}
|
||||
|
||||
extension NSManagedObject: ObjectRepresentation {}
|
||||
@@ -142,4 +147,9 @@ extension DynamicObject where Self: ObjectRepresentation {
|
||||
let context = transaction.unsafeContext()
|
||||
return ObjectSnapshot<Self>(objectID: self.cs_id(), context: context)
|
||||
}
|
||||
|
||||
public func cs_dataStack() -> DataStack? {
|
||||
|
||||
return self.cs_toRaw().managedObjectContext?.parentStack
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user