Combine
All Swift Combine related blog posts to teach you everything you need about using this functional reactive programming framework from Apple.
@Published risks and usage explained with code examples
@Published is one of the property wrappers in SwiftUI that allows us to trigger a view redraw whenever changes occur. You can use the wrapper combined with the ObservableObject protocol, but you can also use it within regular classes. It's essential to understand how the published property wrapper works since ...
RunLoop.main vs DispatchQueue.main: The differences explained
RunLoop.main and DispatchQueue.main are often used as schedulers within Combine. During code reviews, I often encounter inconsistency in using one or another, which made me realize it's not always clear what the differences are. You might be surprised by the outcome of this article! While you can use both RunLoop.main ...
PassthroughSubject vs. CurrentValueSubject explained
PassthroughSubject and CurrentValueSubject are two types from the Combine framework that conforms to the Subject protocol. Both are very similar but have a few keys differences that are important to know. You can see them as custom publishers, but the main difference is that they are a little easier to ...
Master Test Distribution & App Releases Amid App Center’s ShutdownBitrise hosts a webinar on navigating the sunsetting of Microsoft’s Visual Studio App Center. Learn how to transition smoothly to alternative platforms, optimize test and store distributions, and prepare for the future of mobile app releases. The session also includes a sneak peek of Bitrise’s new tool designed to simplify distribution workflows. Watch it now here.
How to observe NSManagedObject changes in Core Data using Combine
Observing changes in Core Data NSManagedObject instances with Combine publishers can be a great solution to keep your user interface in sync with the latest changes. After reading through my posts in the Combine and Core Data categories, you might know more about those individual frameworks, but how do you ...
Getting started with the Combine framework in Swift
Combine was introduced as a new framework by Apple at WWDC 2019. The framework provides a declarative Swift API for processing values over time and can be seen as a 1st party alternative to popular frameworks like RxSwift and ReactiveSwift. If you've been trying out SwiftUI, you've likely been using ...
Error handling in Combine explained with code examples
Once you get started with Combine you'll quickly run into error handling issues. Each Combine stream receives either a value or an error and unlike with frameworks like RxSwift you need to be specific about the expected error type. To be prepared on those cases I'll go over the options ...
Combine debugging using operators in Swift
Combine debugging can be hard with long stack traces which don't help at all. Asynchronous callbacks follow up on each other rapidly and easily make it hard to find the root cause of an issue. It's next to the big learning curve one of the most common reasons to not ...
Creating a custom Combine Publisher to extend UIKit
A Custom Combine Publisher can add missing functionalities to UIKit elements you use every day. A lot of boilerplate code can be removed and implementations can be simplified. A simple example is responding to UIControl events. The standard library comes with a few great extensions to, for example, decode JSON ...