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.
Solution: Create a simple Combine data stream - Swift Tutorial
From the course: Learning Combine with Swift
Solution: Create a simple Combine data stream
(upbeat music) - How did you do? This is how I solved the challenge. The first thing I did in order to create a publisher and associate it with an array is go to line 15. Enter the following let publisher equal array dot publisher. Now I need to create a subscriber. So go to line 17 and answer the following. Let subscriber equal publisher dot assign to backspace dot is enabled on text field. Below that, just so we can track where the text field does change, we will need to add a publisher. So let's go ahead and do that underneath our previous code. Text field dot publisher for backspace dot is enabled dot sink and in curly brackets and curly brackets we're going to enter print parenthesis dollar zero, close parenthesis, close curly brackets. Finally, we need to create an operator that skips the first two elements using the operator drop First, let's go ahead and do that. Go to line…
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)
-
-
-