Learn Combine for Swift in 6 hours
Welcome to the wild world of Combine! Combine is a Swift framework for reactive programming. It simplifies handling asynchronous and event-driven code, allowing developers to create data pipelines, manage tasks, and handle events efficiently. Using concepts like Publishers, Subscribers, and Operators, Combine streamlines data processing, making it easier to build responsive and scalable applications.
Before we begin, I do want to note that Combine is one of many reactive programming frameworks in Swift. Before Combine, there was RxSwift, which is extremely similar to Combine, however, we prefer Combine since it's coming from Apple directly.
Additionally, Apple recently introduced Swift Concurrency, which is the newest and the most important of these frameworks. Currently, Swift Concurrency has not fully replace Combine, however, it seems like that will be the case within a few years. If you want to learn Swift Concurrency, you can view the full course here.
How this course works
Below is a collection of videos that explain everything you need to know about Combine in Swift. The videos increase in skill level, with the first videos addressing programmers who have never used the framework before. These videos have been extracted from larger courses, which we highly recommend watching in full here.
Let's jump in with a simple example...
Next we'll take a brief look at Timers in SwiftUI. While this isn't technically importing the Combine framework, understanding the concept of publishers and subscribers will be key to the rest of the course!
Alright! Now let's fully dive into creating Publishers and Subscribers in Combine.
Before we get into the harder stuff, let's do another example by downloading some images with the Combine framework. In this video you'll get to compare Combine code with (1) regular closure and (2) Swift Concurrency.
Now we will wrap up the course by looking at some advanced examples of Combine usage. The Combine framework has many methods other than "sink" that we can use to manipulate the data coming through our publishers.
That's it... you did it! Now you know Combine!
If you're interested in getting some practice in with Combine, we highly recommend watching the SwiftUI Crypto App course, which has a lot of real-world use cases for the framework (such as networking and searching). You can view the course for free here.
I hope this FREE course was worth your time and helped you on your journey to becoming an expert iOS developer! If you enjoyed it, please don't forget to follow us on YouTube!
Join our Discord: https://discord.gg/Fm4abM2DNh
View source code: https://github.com/swiftfulthinking
Support The Channel: https://www.buymeacoffee.com/nicksarno
Join over 2,000 iOS Engineers in our Discord! We are a community focused on helping each other learn Swift and build amazing iOS applications.
Add your email to get updates on new content & discounts to upcoming courses!