mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-04-23 17:18:35 +02:00
provide direct conversion from DynamicObject to ObjectSnapshot
This commit is contained in:
@@ -75,6 +75,19 @@ extension CoreStoreObject: ObjectRepresentation {}
|
|||||||
|
|
||||||
extension DynamicObject where Self: ObjectRepresentation {
|
extension DynamicObject where Self: ObjectRepresentation {
|
||||||
|
|
||||||
|
// MARK: Public
|
||||||
|
|
||||||
|
/**
|
||||||
|
A thread-safe `struct` that is a full-copy of the object's properties
|
||||||
|
*/
|
||||||
|
public func asSnapshot() -> ObjectSnapshot<Self>? {
|
||||||
|
|
||||||
|
return self.cs_toRaw()
|
||||||
|
.managedObjectContext
|
||||||
|
.flatMap({ ObjectSnapshot<Self>(objectID: self.cs_id(), context: $0) })
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// MARK: ObjectRepresentation
|
// MARK: ObjectRepresentation
|
||||||
|
|
||||||
public func objectID() -> Self.ObjectID {
|
public func objectID() -> Self.ObjectID {
|
||||||
|
|||||||
Reference in New Issue
Block a user