Includes free updates to support the latest version of Swift
Reactive Programming comes to Swift
A Combine Kickstart is your perfect introduction to Apple's framework for reactive programming.
- A single approach: With Combine, Apple is unifying the techniques we've used for decades for passing information around in an iOS or macOS App asynchronously: Target-Action, callbacks, closures, delegates, notifications... all of them.
- Theory and practice: This hand-on, fast-moving kickstart introduces you to using Combine for declarative and reactive programming on Apple platforms.
- Building chains: We focus on core concepts and building discrete, easy-to-understand, pieces of a pipeline that allows your app to react to changes in the state.
Combine is a great way to implement reactive code in Swift in apps that must support iOS 13 or iOS 14.
A Combine Kickstart introduces you to the four pillars of Combine: Publishers, Subscribers, Subscriptions, and Operators. You'll quickly move from introductory examples to becoming a power user as you begin to understand how the pieces fit together.
- Choose your UI: Whether you use UIKit or SwiftUI, Combine can fit into your codebase. We show an example of each.
- Separating Publish and Subscribe: We round out the subscribers with assign(to:on:), assign(to:), and sink(). We break the publishing chain into pieces and learn to republish bits to keep our controllers small and focused and create our own operators.
- Publishing information: Combine makes KVO and Notifications much nicer. We use Subjects to add Combine to existing code.
- Failing and finishing: Use sink() or catch() operator to handle publishers that finish or fail. For some extra magic, wrap the problem parts in a flatMap().
- Timing and debugging: Learn to use debounce(), throttle(), or removeDuplicates() to control the flow and use print() and breakpoint() to investigate and debug our flow and handleEvents() to kick off new processes.
- Multiple Streams: We share() our source with multiple subscribers and perform actions using count(), reduce(), collect(), and scan(). Bring multiple publishers together with merge(), combineLatest(), and zip().
- Network calls: We use URLSession's custom publisher to retrieve values followed by operators to transform the returned output. If the data is JSON we use the decoder() operator to easily produce instances of custom types. We end with a look at how the Future publisher allows us to wrap methods with callbacks into Combine publishers.
Combine is one of those APIs that you resist because it just doesn't seem to make sense - and then something in A Combine Kickstart clicks for you and you want to use Combine everywhere.
Check out these free sample PDFs
The Ultimate Bundle
Own all four books and pay 60% of the price of purchasing all four with The Ultimate Bundle.
Who am I?
My name is Daniel Steinberg, and I’ve been teaching Swift since it launched and iPhone development for more than a dozen years. I’ve spoken at countless conferences around the world, taught Swift to multinational companies such as Apple, Google, and eBay, and built apps for Apple’s platforms as far back as System 7.