Combine is the newest framework from Apple, providing Swift developers with a declarative functional approach to requesting and processing APIs, over time, through a publisher and subscriber model. Get a brief introduction to the framework, and learn at a high-level what Combine is.
- In this course, you will embark on the journey of learning about Apple's newest declarative framework. You will explore Combine, what it is, and how it fits within the architecture of contemporary application developments. So what is Combine? Apple describes Combine as a declarative framework for Swift, to process asynchronous streams of values over time using publishers and subscribers to emit and consume data, respectively. Data streams can be anything from API responses to buttons being tapped, as you observe events and decide how to respond to them. Instead of thinking of data as one-offs, you think of them as constant data streams that you're reacting to. According to Apple, by leveraging Combine, you get a more easily maintainable code base through a centralized event processing paradigm, declaratively, without the need for nested closures and delegate callbacks that can be quite cumbersome. Imagine we're consuming a REST API. We create a publisher that produces events in a data stream asynchronously. We would then have a subscriber to listen for a specific publisher. When that publisher publishes a stream, we get each element in the stream and we may even filter, manipulate, or reformat before displaying it in our UI and this is done using an operator. But a publisher doesn't have to just publish API data. You clicking on a button publishes a signal that is then listened to by another component via subscriber in a similar manner. And there you have it. Combine provides a new and evolving take on how you interact with data.
- Functional reactive programming techniques
- Transmitting data with publishers
- Consuming data with subscribers
- Publishing data
- Creating a simple Combine data stream
- Calling REST APIs
- Handling errors
- Using testing
- Managing threads with schedulers
- Throttling publisher data
- Leveraging advanced operators