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 - Swift Tutorial
From the course: Learning Combine with Swift
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Understand the Combine life cycle2m 13s
-
(Locked)
Transmit data with publishers5m 7s
-
(Locked)
Manipulate data with operators5m 44s
-
(Locked)
Consume data with subscribers4m 5s
-
(Locked)
Publish and subscribe to data with subjects4m 27s
-
(Locked)
Publish data once with Future and Just4m 56s
-
(Locked)
Challenge: Create a simple Combine data stream57s
-
(Locked)
Solution: Create a simple Combine data stream2m 9s
-
(Locked)
-
-
-