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: Call an API using schedulers and backpressure

Solution: Call an API using schedulers and backpressure - Swift Tutorial

From the course: Learning Combine with Swift

Start my 1-month free trial

Solution: Call an API using schedulers and backpressure

(upbeat music) - [Instructor] How did you fare? This should be a relatively straight forward challenge, but this is how I approached the challenge. I used a delay operator and set a value of three seconds on line 15. So what I did was, I went to line 15 and entered the following, .delay for 2.0, scheduler. I entered queue. And this allows it to run on a background queue. Next, I created a custom subscriber on line 17. I entered final class custom subscriber. Of type subscriber. And that implemented the protocols required. Starting with the aliases. For inputs I had Int and for failure I had Never. In addition requires certain functions to be implemented. I entered the following, func, receive, subscription, subscription. And inside I set request to have unlimited. I then created the following function. Func, receive, input, type Int, subscribers demand. Within that I entered the following. Print, number, input.…

Contents