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.
Publish data once with Future and Just - Swift Tutorial
From the course: Learning Combine with Swift
Publish data once with Future and Just
- [Instructor] Just and Future are two special types of publishers commonly used in Combine. Just omits a single result before either terminating successfully or failing. You could use Just to wrap around a primitive value, say a string or number into a publisher with simplicity and have it return just once. Future on the other hand wraps a request response into a single result, either as an output value or failure completion. It doe so by wrapping any asynchronous call such as a REST end point in to a publisher. You will commonly use this when you want to make a single request and get back a single response. And an example of something you may want to wrap into a publisher is Apple's own permissions requesting framework. A promise is a closure that returns a result from a future call that you can use to either ingest resulting values or resulting error. Now let's transition from theory into practice and take a look at…
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)
-
-
-