Generic Structure

Just

A publisher that emits an output to each subscriber just once, and then finishes.

Declaration

struct Just<Output>

Overview

You can use a Just publisher to start a chain of publishers. A Just publisher is also useful when replacing a value with Publishers.Catch.

In contrast with Result.Publisher, a Just publisher can’t fail with an error. And unlike Optional.Publisher, a Just publisher always produces a value.

Topics

Creating a Just Publisher

init(Output)

Initializes a publisher that emits the specified output just once.

Instance Properties

let output: Output

The one element that the publisher emits.

Instance Methods

func contains(Output) -> Just<Bool>
func contains(Output) -> Publishers.Contains<Just<Output>>
func max() -> Just<Output>
func max() -> Publishers.Comparison<Just<Output>>
func min() -> Just<Output>
func min() -> Publishers.Comparison<Just<Output>>
func removeDuplicates() -> Just<Output>
func switchToLatest() -> Publishers.SwitchToLatest<Output, Just<Output>>

Relationships

Conforms To

See Also

Convenience Publishers

class Future

A publisher that eventually produces a single value and then finishes or fails.

Beta
struct Deferred

A publisher that awaits subscription before running the supplied closure to create a publisher for the new subscriber.

Beta
struct Empty

A publisher that never publishes any values, and optionally finishes immediately.

Beta
struct Fail

A publisher that immediately terminates with the specified error.

Beta
struct Record

A publisher that allows for recording a series of inputs and a completion, for later playback to each subscriber.

Beta

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software