Reactive Programming in iOS with Combine

Learn how to manage asynchronous work in iOS the reactive way: using Combine! Master the techniques and best practices to write declarative Combine code in playgrounds and complete iOS app projects. By Josh Steele.

4.2 (17) · 3 Reviews

Download materials
Save for later
Comments
Share

Learning path

This is part of the Declarative Programming with Combine learning path. View path.

Who is this for?

iOS developers who have some experience or who have worked their way through the previous courses in the iOS and Swift for Beginners learning path.

No previous reactive programming experience needed — we’ve got you covered!

Covered concepts

  • Reactive Programming
  • Combine Basics
  • Publishers
  • Subscribers
  • Transforming Operators: Collect, map, replaceNil and more
  • Filtering Operators: filter, removeDuplicates, ignoreOutput and more
  • Combining Operators: prepend, append and more
  • Timing Operators
  • Scheduling Operators
  • Sequencing Operators

Part 1: Getting Started

01
Toggle description

Welcome to the course! Find out a bit about the history of reactive programming, and a high level overview of Combine.

Toggle description

Learn about Publishers and Subscribers, which are the endpoints of the Combine pipeline, and how they work with one another.

Toggle description

Learn about some built in operators for Subscribers as well as Subjects, which help connect the imperative and declarative world.

Toggle description

In this hands-on challenge, use your knowledge of publishers and subscribers to create a blackjack dealer.

Conclusion 1:19
Toggle description

Recap what you learned about publishers and subscribers, and gear up for the rest of the course.

Part 2: Transforming & Filtering Operators

Toggle description

Learn about what Operators are in Combine, and get an overview of which ones you’ll learn about in this part of the course.

Toggle description

Collect, map, replaceNil and replaceEmpty are basic operators that can be used to transform data into another form.

Toggle description

Learn about how the scan and flatMap operators can be used in your code to do more advanced transformations.

Toggle description

In this hands-on challenge use your knowledge of transforming operators to lookup a phone number in a contact book.

Toggle description

Basic filtering operators like filter, removeDuplicates, ignoreOutput and compactMap can be used to narrow down which values get sent downstream to subscribers.

Toggle description

Learn about more filtering operators: first(where:), last(where:), drop, and prefix, which give you additional ways to keep values from traveling downstream.

Toggle description

In this challenge, use your knowledge of filtering operators to slim down an array of numbers to a predefined set of values.

Conclusion 0:36
Toggle description

Review what you’ve learned about transforming and filtering operators.

Part 3: Combining Operators

Toggle description

You’ve learned about several operators already, but there’s more! In this part, you’ll learn about combining operators.

Prepend 9:21
Toggle description

Discover the prepend family of operators, which consists of prepend(Output), prepend(Sequence), and prepend(Publisher).

Append 8:21
Toggle description

Now check out the append family of operators, which consists of append(Output), append(Sequence), and append(Publisher).

Toggle description

In this hands-on challenge, turn your old-school 7 digit phone number into a modern day number using combining operators.

Toggle description

Learn how you can use operators such as switchToLatest, merge(with:), combineLatest and zip to perform more advanced combinations of data from publisher.

Toggle description

In this episode, see examples of switchToLatest, merge(with:), combineLatest and zip in a Swift playground.

Toggle description

In this hands-on challenge, build upon the last challenge to interleave multiple arrays of data together.

Conclusion 0:47
Toggle description

Let’s recap the different combining operators you learned about in this part of the course.

Part 4: Timing, Scheduling and Sequencing Operators

Toggle description

Learn about the final set of operators we’ll cover: timing, scheduling and sequencing operators.

Toggle description

The basic timing operators like delay and collect do just what they advertise - delay values from a publisher and collect a series of emitted values.

Toggle description

The debounce and throttle operators come in handy when collecting data such as a person typing, keeping you from checking after every keystroke.

Toggle description

Learn how the timeout operators can be used to cause a publisher to time out and complete, and measureInterval to measure the interval between emissions.

Toggle description

In this hands-on challenge, use your knowledge of timing operators to decode a message from a set of mysterious data.

Toggle description

Learn about the schedule and receive operators, which can be used to tell Combine which Scheduler to use when running the operations.

Toggle description

Sequencing operators such as max, min, count and output can give you information on the sequence of emitted values as a whole.

Toggle description

Challenge time! Use your knowledge of sequence operators to give a golfer a report on their golf game.

Conclusion 2:07
Toggle description

Congrats on finishing the course! Review what you’ve learned and find out where you can go to learn more about Combine.

Up next

iOS & Swift
Intermediate Combine
Combine has a number of operators to help with handling network data, sharing resources with multiple subs... more

Instructors

Contributors

Over 300 content creators. Join our team.