diff --git a/Sources/ObjectRepresentation.swift b/Sources/ObjectRepresentation.swift index a9d4101..843fe67 100644 --- a/Sources/ObjectRepresentation.swift +++ b/Sources/ObjectRepresentation.swift @@ -77,6 +77,16 @@ extension DynamicObject where Self: ObjectRepresentation { // MARK: Public + /** + An `ObjectPublisher` wrapper for the exact same object + */ + public func asPublisher() -> ObjectPublisher? { + + return self.cs_toRaw() + .managedObjectContext + .map({ $0.objectPublisher(objectID: self.cs_id()) }) + } + /** A thread-safe `struct` that is a full-copy of the object's properties */