Swift Concurrency, Combine, and Core Data

Today is the last day of WWDC and like every year, the week of WWDC went by faster than I can watch the videos and study the contents.

This year, Apple announced a major new Swift feature which is Swift Concurrency. This feature overhauls the way we write asynchronous code, and the Swift team has essentially rewritten the way Swift deals with concurrency by introducing a new threading model. My focus has mostly been on Swift Concurrency related videos, and I’ve started going over all of the concurrency proposals to make sure I don’t miss anything.

Unfortunately, Swift Concurrency will only be available on iOS 15 and above for the time being but that won’t stop me from diving deep into it in the coming months.

With Swift’s new concurrency features, a lot of other frameworks and APIs have been overhauled either automatically by automated translations from Objective-C to Swift, or by the respective teams. Core Data is such a framework that has received some nice updates to make it work nicely with Swift Concurrency. I’ll be exploring this over the coming weeks so I can update my Practical Core Data book (for free). In addition to Swift Concurrency support, Core Data’s CloudKit integration received some attention to. In iOS 15 NSPersistentCloudKitContainer has support for CloudKit sharing, so make sure to look out for that in the next update of my Core Data book.

Combine was one of the most notable absentees this week which led to a lot of questions and confusion amongst Combine enthusiasts. Is Apple deprecating Combine? What’s Combine’s place in an async / await driven world? Should we stop using Combine?

The short answer, I think, is that Apple is happy where Combine is and that async / await will impact it mostly in areas where Combine was used as an asynchronous task runner rather than a way to observe state and react to state changes. In the links section for this newsletter I’ll link to a post I wrote on Tuesday that explains my initial thoughts around Combine in async / await world.

I honestly wish Apple had at least mentioned Combine and how we “should” use it in iOS 15 to provide us with some context instead of letting us figure out Combine’s place on our own. Or maybe Apple not saying anything says a lot? I don’t know.

I do know that I will be updating Practical Combine soon with some improved examples that might reflect its place in an async / await world better. And I’ll also make sure to mention async / await as an iOS 15+ alternative when relevant. I’m sure that a lot of folks are currently supporting iOS 13+ so it would not make sense for me to remove certain examples completely in favor of async / await. Of course, the Practical Combine update will be made available for free, just like the Practical Core Data update.

Cheers, Donny

ps. I bought a new domain name this week.



Practical Core Data

Practical Core Data helps you learn Apple's Core Data framework without requiring any prior knowledge. You'll learn how to integrate Core Data in UIKit and SwiftUI applications. The book also covers data modeling, synchronizing your store with a custom backend or CloudKit, profiling and improving performance in a Core Data app, and using Core Data in unit tests.

By the end of the book, you'll know exactly how you can start using Core Data in modern applications.

Buy Practical Core Data with 20% off

Practical Combine

Practical Combine is a book that will help you learn Combine from scratch. You will learn about all aspects of Combine in a natural flow where you're eased into functional reactive programming with simple examples, and the difficulty gradually builds up to complicated integrations in later chapters.

Buy Practical Combine with 20% off

🎶 Currently on repeat 🎶

If you follow me on Twitter you probably know that I play guitar. I'm a huge music lover and want to share this with you. In this section I will share a new album that I've been enjoying a lot every week.

Atryu - Baptize

It’s been a long time since I’ve listened to anything from this band. They release a new album recently and it’s really good. Very string Avenged Sevenfold vibes on some of the songs and it’s great.


Other content that I really want to share with you

WIth Apple seemly ignoring Combine this WWDC, a lot of folks are wondering what Combine’s iOS 15+ future looks like. In this post I attempted to gather my thoughts and opinions on where I think Combine is going in the mid-to-long term.

An article by Donny Wals

This repository created by Paul Hudson contains a collection of articles written by the iOS community. If you’ve published content about WWDC this week, make sure to submit a pull request to add it to this list!

In this overview from Apple, you’ll learn which technologies are new this year along with some links to check out. It’s a great place to quickly find out what Apple’s announced this week.