From the course: Learning Combine with Swift

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Transmit data with publishers

Transmit data with publishers - Swift Tutorial

From the course: Learning Combine with Swift

Start my 1-month free trial

Transmit data with publishers

- [Instructor] Publishers in essence, provide a sequence of data streams over time and when available, upon request. Publishers are at the heart of Combine. Let's dive deeper. The Publisher Protocol sets forth a contract to transmit sequences of values over time for the subscribers to listen to. The protocol only has two possible outcomes, outputs and failure. This is in contrast to subscribers, which you will learn about later on, which declares input and failure. Values are transmitted in sequence over time, but only if one or more subscribers are created to listen for those values. If there are no subscribers, the publisher terminates. Think of this in another way. A publisher's data stream can terminate, is through an explicit completion signal. Let's visualize this once more. You have a publisher and a subscriber counterpart. The publisher produces output and the subscriber listens for input. Both subscriber…

Contents