Structure

Optional.Publisher

A Combine publisher that publishes an optional value to each subscriber exactly once, if the optional has a value.

Declaration

struct Publisher

Overview

In contrast with Just, an Optional.Publisher may send zero values and instead finish normally, if output is nil.

Topics

Type Aliases

typealias Optional.Publisher.Failure

The kind of error this publisher might publish.

typealias Optional.Publisher.Output

The kind of value published by this publisher.

Initializers

init(Optional<Wrapped>.Publisher.Output?)

Creates a publisher to emit the optional value of a successful result, or fail with an error.

Instance Properties

let output: Wrapped?

The optional value to deliver to each subscriber.

Instance Methods

func receive<S>(subscriber: S)

Implements the publisher protocol by accepting the subscriber if the output optional has a value, or terminating immediately with an empty subscription otherwise.

Relationships

Conforms To