by this publisher. associatedtype Output /// The kind of errors this publisher might publish. /// Use `Never` if this `Publisher` does not publish errors. associatedtype Failure : Error /// This function is called to attach the specified `Subscriber` to this `Publisher` by `subscribe(_:)` func receive<S>(subscriber: S) where S : Subscriber, Self.Failure == S.Failure, Self.Output == S.Input } Publisher
of the Published property as well as the corresponding `Publisher`. public init(initialValue: Value) public class Publisher : Publisher { /// The kind of values published by this publisher. public typealias Output = Value /// The kind of errors this publisher might publish. /// /// Use `Never` if this `Publisher` does not publish errors. public typealias Failure = Never /// This function is called to attach the specified `Subscriber` to this `Publisher` by `subscribe(_:)` public func receive<S>(subscriber: S) where Value == S.Input, S : Subscriber, S.Failure == Published<Value>.Publisher.Failure } /// The property that can be accessed with the `$` syntax and allows access to the `Publisher` public var projectedValue: Published<Value>.Publisher { mutating get } }
values this subscriber receives. associatedtype Input /// The kind of errors this subscriber might receive. /// Use `Never` if this `Subscriber` cannot receive errors. associatedtype Failure : Error /// Tells the subscriber that it has successfully subscribed to the publisher and may request items. /// /// Use the received `Subscription` to request items from the publisher. func receive(subscription: Subscription) /// Tells the subscriber that the publisher has produced an element. func receive(_ input: Self.Input) -> Subscribers.Demand /// Tells the subscriber that the publisher has completed publishing, either normally or with an error. func receive(completion: Subscribers.Completion<Self.Failure>) } Subscriber
filter first handleEvents ignoreOutput last log mapError max min output prefix prepend print removeDuplicates replaceEmpty replaceError replaceNil retry scan setFailureType switchToLatest zip map contains flatMap reduce merge drop collect From WWDC19 Introducing Combine