From the course: Learning Combine with Swift
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Understand the Combine life cycle - Swift Tutorial
From the course: Learning Combine with Swift
Understand the Combine life cycle
- [Instructor] It helps to take a birds-eye view of the Combine lifecycle so that you can understand how each of the actors interacts, the sequence of events, what comes before what. Let's get those answers for you and set the foundation for the remainder of the course. So we have a subscriber and a publisher. Say the publisher asynchronously calls a URL and returns data. The subscriber first subscribes to that publisher, which in turn creates a subscription that is given back to the subscriber. With the subscription in place, the subscriber can then request values from the publisher, tapping into a stream of events being returned from the publisher. Now, all subscribers conform to the cancelable protocol, allow them to cancel the subscription if there are no subscribers left. The publisher terminates as well. Sub-publishers, if defined so, could also emit a completion or failure signal causing the subscription…
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
-
-
-
-
Understand the Combine life cycle2m 13s
-
Transmit data with publishers5m 7s
-
Manipulate data with operators5m 44s
-
Consume data with subscribers4m 5s
-
Publish and subscribe to data with subjects4m 27s
-
Publish data once with Future and Just4m 56s
-
Challenge: Create a simple Combine data stream57s
-
Solution: Create a simple Combine data stream2m 9s
-
-
-
-