The Swifty Combine Framework Course

Learn to master the Combine framework with our course including practical examples in UIKit and SwiftUI. Build responsive apps with ease.

Boost Your App Development Skills with Combine: Build More Efficient and Robust iOS Apps

If you want to create better iOS apps with cleaner and more maintainable code, you should learn the Combine framework. It is a powerful framework that allows you to easily manage asynchronous events and data flow in your app. It can simplify your code and make it easier to read and maintain, even in large projects. By learning Combine, you can make your app development process faster and more efficient, while also creating better experiences for your users.

Combine Framework in Swift, the pros and cons

Functional programming relies heavily on delegates, target/action, and ad-hoc callbacks. By using Combine you can convert your code away from these patterns. Your codebase will become more readable, and better maintainable.
Swift Combine offers a declarative Swift API for processing values over time.

Combine is a huge step forward for developers in the Apple universe. As beautiful as it is, it is a challenging tool to master. Both because of the paradigm shift away from functional programming and because of the lack of learning resources.

Benefits of Combine

  • Better code organization: Combine provides a unified and declarative approach to handling asynchronous events, simplifying and streamlining your code. This can make your code easier to read and maintain.
  • Increased productivity: By leveraging Combine's powerful operators and publishers, you can write code that is both expressive and concise, allowing you to build complex functionality with fewer lines of code.
  • Improved performance: Combine can help you optimize your app's performance by reducing the amount of work your app needs to do when handling asynchronous events.
  • Future-proofing: Asynchronous programming is becoming increasingly important in the world of iOS development, and Combine represents Apple's recommended approach. By learning Combine, you'll be well-positioned to handle future iOS updates.
  •  Improve your understanding of SwiftUI: Combine is used heavily in SwiftUI. Sometimes it is difficult to understand the data flow in SwiftUI. By learning Combine you can better follow what SwiftUI does under the hood with its automatic UI update.
  •  Work better with UIKit and SwiftUI together: If you have an existing UIKit project with new features in SwiftUI or start a new SwiftUI project from scratch, chances are that you will need to use UIKit and SwiftUI together.  I struggled in particular with the data flow. The best approach to not generate spaghetti code is to change how I write UIKit and make it more declarative with Combine. Using similar patterns in UIKit and SwiftUI makes it easier to work and reduces complexity. Thanks to the Combine's power!

The Problems with Combine

  • Steep Learning Curve: Combine can be a challenging framework to learn due to its complexity and functional programming concepts. 
  • Debugging: Debugging Combine can be tricky as it can involve multiple operators and publishers. 
  • Memory Management: If not managed properly, Combine can cause memory leaks and performance issues. 
  • Integration with Existing Codebase: It can be challenging to integrate Combine into an existing codebase, especially if the codebase uses a different approach or architecture. 
  • Limited Resources and Community: Compared to more established frameworks, Combine has limited resources and community support, which can make it harder to find help or get answers to questions.

Warning! Don't even think of writing one line of Combine Code in your production project until you master how to write functional reactive code.

In order to use the Combine framework, you need to really understand it. You need to know how to profile and debug it. Including knowing how to write unit tests. 

Why did I make this course about Swift Combine?

Have you struggled to understand and learn Functional Reactive Programming? You're not alone. RxSwift, ReactiveCocoa, and Combine can be difficult to grasp, frustrating and discouraging you. That's why I created this course - the one I wish I had when I was starting out. My approach is different. I break down complex concepts into understandable and practical examples. I show you the theory behind it, and then demonstrate how it works in real-life situations.

By the end, you'll not only understand but also be able to implement and apply what you've learned. Say goodbye to confusion and frustration, and hello to easily mastering Combine in UIKit and SwiftUI.

Your Benifits

In-depth Explanations

This course is designed with your understanding in mind. Functional reactive programming can be tricky to grasp, but don't worry, I'll guide you through it step by step. I use graphics and overviews to help you truly understand the concepts and how they work in practice.

Real-world applications

The course provides practical examples of how to use Combine in real-world scenarios, giving you the skills and confidence to apply what you learn to your own projects.

Combine Examples in UIKit and SwiftUI

I believe that in the future we will see both UIKit and SwiftUI in iOS development, often in the same project. I therefore added all sample projects in both SwiftUI and UIKit. 

The Roadmap to the Combine Framework

Subscriptions

First, you will learn the basics of the Combine framework and functional reactive programming.  I will explain how adding a subscriber like sink or assign to a publisher creates a subscription. You will learn how to cancel a subscription which means how to stop a data stream from passing values. You will also learn that passing an error 💣 will complete the data stream.

Combine Publisher

In the second section, you will learn about the different types of publishers like CurrentValueSubjects, PassthroughSubjects, Future, Just, and publishers in the Foundation framework.
The Foundation framework offers Combine extensions that allow for using publishers from commonly-used types. This simplifies the process of integrating Combine into existing codebases.

 ➡️ There will be 2 demo projects in this section:
The first one is a To-do app where we will use Subjects (one project with UIKit and one with SwiftUI).
The second is an app where we will use Firebase Authentication.

Operators: Combining Multiple Publishers

In the following sections, we will get to know all the operators.
A Combine operator can help you process values over time.  
I will start by showing you how to combine multiple data streams together. This is interesting for complex UI where you have a lot of user interface events that you want to use to update the UI accordingly like a Sign-Up page.

Combining operators:
append, merge, zip, combineLatest, share, multicast, flatmap, switchToLatest, etc.  

Operators for Transforming and Error Handling

 In this section, we will talk about transforming operators which you can use to change the output value of a data stream.

You will learn about mapping operators:
- how to deal with optional values
- how to pass errors in data streams (throw errors)
- type matching of Failure types
- mapping of errors
- dealing with error by using catch, tryCatch, and replaceError operators.

Sequential Operators 

You will start learning about Sequence operators. These operators have special behavior. Some of them will only emit one value or only emit a value if the upstream publisher sends a completion.
You will get to know about::  first, min, max, reduce, etc.  

Filtering Operators

In this section, you'll learn how to optimize work and enhance user interaction by exploring powerful filtering operators like filter, tryFilter, dropFirst, debounce, and throttle, which allow you to efficiently process data only when necessary and respond to user changes dynamically.

Operatorators: Scheduler Protocol and Multithreading

I will talk about the Scheduler protocol. You already encountered a couple of operators using this protocol, like denouncing and collecting (byTimeInterval). In addition to the Scheduler protocol, I will also show you how to define time intervals for schedulers.

We also have a look at how multithreading and Combine data streams work together. This is the part I struggled to understand. You will hear a lot about how subscriptions are set up, how (in which context) they are managed, and how they pass values.
You will learn how to use receive(on) and subscribe().   

Design Patterns

The most important section. I will tell you about communication patterns and how to use Combine. You will see how useful Combine is in passing data in your app.

 ➡️ There will be multiple demo projects in this section both for UIKit and SwiftUI with MVVM and the Coordinator pattern

Final Project and Testing Combine

In this section, I want to introduce you to your final project. I will show you what you could implement with the JSON placeholder API. Together we will work on fetching the Album and Photo JSONs.

This is a great example to practice:
-> URLSession dataTaskPublisher
-> loading image files in lists
-> see error handling in a project

New in this section are:
-> write unit tests for Combine data streams
-> profiling with Timelane in Instruments

Most of the section is using SwiftUI. But I added a shorter video, where you can get the equivalent project in UIKit.  

Course Curriculum

Frequently Asked Questions (FAQ)

- you want to learn or already started learning SwiftUI and want to get more knowledge with Combine,
- if you want to stay up to date with Apples newest and most promising APIs,
- you want to write easier to read and maintain code,
- if you want to simplify the way you write code by eliminating Ad-hoc callbacks from your main logic,
- if your dream is to stop using delegates and want to learn new design and architecture patterns.

This course shows examples both in UIKit and SwiftUI which takes around 30% of this course. Learning Combine for UIKit and SwiftUI will allow you to directly
- use Combine for your existing projects that are written in UIKit so you can use Combine in your daily work now.
- work with Combine in SwiftUI projects that you start from scratch
- integrate new SwiftUI views in your existing UIKit projects and handling the data flow between them with Combine
- drop down from SwiftUI to UIKit for components that are not yet available and handle the data flow with Combine.

You are good to go if you
-  are an intermediate/ advanced level iOS developer
- have a basic knowledge to build user interfaces with UIKit or SwiftUI (for the demo projects)

This is not a beginner course! You need to have a solid understanding of the Swift programming language.

Yes, of course. If you are not happy with my course, I will give you a full refund. You have a 30day money-back guarantee.

Karin Prater

I have a Ph.D. in physicist, during which I started to love software engineering. Since I am also passionate about learning I started to build my own learning app. 

I am also very enthusiastic about design, which is a bit unusual for most physicists, I am putting a strong focus on the UI part.  In my courses, you will jump right into the subject and learn to design by actually designing.

From my former teaching experiences, I know that learning by trying is the most fun. So I will encourage you to use the tools I am showing you directly in your own projects. May they be small or grant.

Reviews