Instance Method

share()

Returns a publisher as a class instance.

Declaration

func share() -> Publishers.Share<AnyPublisher<Output, Failure>>

Return Value

A class instance that republishes its upstream publisher.

Discussion

The downstream subscriber receieves elements and completion states unchanged from the upstream publisher. Use this operator when you want to use reference semantics, such as storing a publisher instance in a property.