QueryPublisher

@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
public class QueryPublisher<E>: Publisher
where E: EntityInspectable & __EntityRelatable, E.EntityBindingType.EntityType == E

Combine publisher for an ObjectBox query. You obtain an instance of this type via the publisher property on Query.

  • The result type of this publisher.

    Declaration

    Swift

    public typealias Output = [E]
  • The error type of this publisher.

    Declaration

    Swift

    public typealias Failure = ObjectBoxError
  • Register a combine subscriber to be notified whenever the query’s contents change. Notifications are dispatched on the main queue.

    Important

    There may be spurious calls to your callback when your query results haven’t actually changed, but something else in this box has.

    Declaration

    Swift

    public func receive<S>(subscriber: S)
        where S: Subscriber, QueryPublisher.Failure == S.Failure, QueryPublisher.Output == S.Input

    Parameters

    subscriber

    The subscriber you want to receive the subscription.

  • Register a combine subscriber to be notified whenever the query’s contents change.

    Important

    There may be spurious calls to your callback when your query results haven’t actually changed, but something else in this box has.

    Declaration

    Swift

    public func receive<S>(subscriber: S, dispatchQueue: DispatchQueue)
        where S: Subscriber, QueryPublisher.Failure == S.Failure, QueryPublisher.Output == S.Input

    Parameters

    subscriber

    The subscriber you want to receive the subscription.

    dispatchQueue

    The queue on which new data and completion are to be delivered.