ReactiveNamespace

public struct ReactiveNamespace

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

Public

  • The ListPublisher instance

    Declaration

    Swift

    public let base: ListPublisher
  • Returns a Publisher that emits a ListSnapshot whenever changes occur in the ListPublisher

    listPublisher.reactive
        .snapshot(emitInitialValue: true)
        .sink(
            receiveCompletion: { result in
                // ...
            },
            receiveValue: { (listSnapshot) in
                dataSource.apply(
                    listSnapshot,
                    animatingDifferences: true
                )
            }
        )
        .store(in: &cancellables)
    

    Declaration

    Swift

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

    Parameters

    emitInitialValue

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

    Return Value

    A Publisher that emits a ListSnapshot whenever changes occur in the ListPublisher.