Under The Bridge Under The Bridge

Tag: combine
Rx For Reacting To Combine-ations

Remember all the fuss about FRP back when Reactive Cocoa was all the new hotness? Kinda a good chuckle as 2020 approaches, isn’t it? Whilst its appeal turned out to be, as they say, selective, it and later FRP libraries such as RxSwift do have a following among those who don’t mind fighting the framework (have us tell you the story of the MQTT/Core Data/RAC stack we parachuted in to save the day for some time, if you want to see a visibly apoplectic troll, but hey, we managed to drag it across the liquidity event finish line, it’s all good) but general consensus is of the RxNot mindset that designing for maintainability is difficult enough already without seriously considering an architecture lacking any first party support and actively hostile to established platform paradigms…

… and then, all of a sudden! Here. We. Are. With. Combine:

Introducing Combine: Combine is a unified declarative framework for processing values over time. Learn how it can simplify asynchronous code like networking, key value observing, notifications and callbacks.

Combine in Practice: Expand your knowledge of Combine, Apple’s new unified, declarative framework for processing values over time. Learn about how to correctly handle errors, schedule work and integrate Combine into your app today.

Well, that’s certainly a great deal of previously passionate architectural debates rendered instantly obsolete, t‘isn’t it now? OK, Rx fans, take yourselves a victory lap for being all ahead of the game, grab yourself the RxSwift to Apple’s Combine Cheat Sheet and call it a day. The rest of us, well, time to get catching up now!

The first bookmark you need is this veritable epic of online documentation, by virtually unanimous agreement the most comprehensive and reliable source on this subject, not excluding Apple:

Using Combine by Joseph Heck

The book is available online at no cost. If you find the content useful, please consider supporting the effort with a purchase of the PDF or ePub version. The money collected for sales of this book will go to hiring editors (copyediting and technical editing), and if sufficient funds exist, hiring graphic design for diagrams. The content for this book, including sample code and tests, are sourced from the GitHub repository

However, if that’s a little intimidating to dive right into, here’s our picks for the best quick reads and views to get started:

SwiftUI & Combine: Better Together

Combine101 by a coauthor on the inevitable Wenderlich book

Swift Combine Framework Tutorial: Getting Started

Getting started with the Combine framework in Swift

A Crash Course in Combine

OK then, now that we’ve got some basic grounding, let’s take a look at some real example apps:

MovieSwiftUI: “SwiftUI & Combine app using MovieDB API. With a custom Flux (Redux) implementation.”

2048-swiftui: “2048 game using SwiftUI and Combine.”

CombineSlotMachine: “A basic slot machine game that demonstrates using the Combine framework in a UIKit app.”

And the next place to check out is the GitHub repos and Slack channel at

Combine CommunityCommunity projects & experimentations around Apple’s Combine framework

Note particularly awesome-combineCombineDataSources, and CombineCocoa.

And here’s a selection of the more interesting miscellaneous tips and tricks we’ve found:

Modern Networking in Swift 5 with URLSession, Combine and Codable

Hmmm, looks like CareKit uses Combine and CoreData as a local database…”

Error Handling in Swift Combine Framework

Error handling in Combine explained with code examples

Debugging with Swift Combine Framework

Combine debugging using operators in Swift

GRDBCombine: “A set of extensions for SQLite, GRDB.swift, and Combine”

Using Combine to Supplement Delegates With Publishers

CombineGRPC, a library that integrates Swift gRPC and Combine

Map vs FlatMap vs SwitchToLatest

Simple custom Combine operators + Building a custom `sample` operator

Creating a custom Combine Publisher to extend UIKit

Backpressure in Reactive Streams

Playing With Combine: Grid Layout in SwiftUI

Should be right up to speed making it through all that!