Instance Method

autoconnect()

Automates the process of connecting or disconnecting from this connectable publisher.

Declaration

func autoconnect() -> Publishers.Autoconnect<Self>

Return Value

A publisher which automatically connects to its upstream connectable publisher.

Discussion

Use autoconnect() to simplify working with ConnectablePublisher instances, such as those created with makeConnectable().

let autoconnectedPublisher = somePublisher
    .makeConnectable()
    .autoconnect()
    .subscribe(someSubscriber)