Implement ObjectRepresentation on ObjectMonitor, ObjectPublisher, and ObjectSnapshot for future APIs

This commit is contained in:
John Estropia
2021-01-02 09:59:15 +09:00
parent e1aed37da0
commit 2cd8101987
4 changed files with 101 additions and 43 deletions

View File

@@ -125,15 +125,23 @@ public final class ObjectPublisher<O: DynamicObject>: ObjectRepresentation, Hash
}
// MARK: ObjectRepresentation
public typealias ObjectType = O
// MARK: AnyObjectRepresentation
public func objectID() -> O.ObjectID {
return self.id
}
public func cs_dataStack() -> DataStack? {
return self.context.parentStack
}
// MARK: ObjectRepresentation
public typealias ObjectType = O
public func asPublisher(in dataStack: DataStack) -> ObjectPublisher<O> {
let context = dataStack.unsafeContext()
@@ -173,11 +181,6 @@ public final class ObjectPublisher<O: DynamicObject>: ObjectRepresentation, Hash
}
return ObjectSnapshot<O>(objectID: self.id, context: context)
}
public func cs_dataStack() -> DataStack? {
return self.context.parentStack
}
// MARK: Equatable