ReactiveNamespace

@dynamicMemberLookup
public struct ReactiveNamespace

Combine utilities for the ObjectPublisher are exposed through this namespace. Extend this type if you need to add other Combine Publisher utilities for ObjectPublisher.

Public

  • The ObjectPublisher instance

    Declaration

    Swift

    public let base: ObjectPublisher
  • Returns a Publisher that emits an ObjectSnapshot? whenever changes occur in the ObjectPublisher. The event emits nil if the object has been deletd.

    objectPublisher.reactive
        .snapshot(emitInitialValue: true)
        .sink(
            receiveCompletion: { result in
                // ...
            },
            receiveValue: { (objectSnapshot) in
                tableViewCell.setObject(objectSnapshot)
            }
        )
        .store(in: &tableViewCell.cancellables)
    

    Declaration

    Swift

    public func snapshot(emitInitialValue: Bool = true) -> ObjectPublisher.SnapshotPublisher

    Parameters

    emitInitialValue

    If true, the current value is immediately emitted to the first subscriber. If false, the event fires only starting the next ObjectSnapshot update.

    Return Value

    A Publisher that emits an ObjectSnapshot? whenever changes occur in the ObjectPublisher. The event emits nil if the object has been deletd.

Available where O: NSManagedObject

Available where O: CoreStoreObject