Tag Archives: coredata

Ensembles Reanimated

TLDR; I rewrote Ensembles — my 13-year-old Objective-C sync framework — in Swift 6, using Claude Code. It now supports SwiftData, has new backends, and is in public beta.

Way back in 2013, I was trying to ship cloud sync in a predecessor to Studies app. I’d been using Apple’s iCloud Core Data sync, and it was a disaster. Data corrupted silently. Devices diverged and never recovered. I spent more time debugging Apple’s sync than building the app.

So I what any level-headed developer would do — I reverse engineered it. I dug into what Apple was doing under the hood, figured out the design problems, and built my own replacement. I called it Ensembles, and pushed it to GitHub at GOTO Aarhus later that year.

The core idea behind Ensembles is that sync doesn’t need a central server. Each device keeps its own copy of the Core Data store. The framework watches your saves, generates compact change logs, and when changes arrive from another device, it merges them in. There’s no server that understands your data model. No hosting costs. Each device is an equal peer.

In 2013, nobody had a word for this. It was just “sync.” I released an open source version of Ensembles, and a little later a more capable commercial version called Ensembles 2, with CloudKit support, better memory usage, and additional backends.

More recently, the web community has started to embrace this approach and given it a name: local-first. I attended the inaugural Local-First Conf in Berlin in 2024, and gave a short talk about my journey with Ensembles — at that point more than 10 years old. It was good to see so much energy around ideas that some of us had relied on for a long time. And it’s great having a word for it; it means you can talk about it, have a conference about it, and push the idea forward.

An old framework in a new world

The original Ensembles was written in Objective-C. It worked with Core Data. The code was solid and I was still maintaining it, but the world had moved on. Apple introduced SwiftData. The community adopted Swift 6 with strict concurrency. Nobody starts a new Objective-C project in 2026.

I was expecting a long, slow decline. Keep it compiling, fix the odd issue, watch it fade out.

What if?

Then about a week ago, I had an idea: what if I used Claude Code to rewrite Ensembles in Swift 6?

Not a wrapper around the old code. A real rewrite — async/await, Sendable types, structured concurrency. And while I was at it, add some new backends. Maybe even try SwiftData support alongside Core Data.

A week later

Within a day, the core Swift rewrite was compiling and passing tests. I directed Claude Code throughout — correcting mistakes, steering it away from bad decisions. It made plenty of them. But the Ensembles architecture mapped reasonably well to Swift, which helped.

One thing that made this feasible: Ensembles had extensive tests. Without those, I wouldn’t have attempted it. When you’re rewriting a sync framework — where bugs mean data loss — you need to know things actually work. The tests were the safety net. Claude Code would produce Swift code, the tests would catch problems, and I’d fix things up. Without that feedback loop, this would have been reckless.

By the second day, I was adding backends. Then SwiftData support came together. The rest of the week was cleanup — licensing, documentation, more tests — and now Ensembles 3 is in beta.

What Ensembles 3 is

For anyone who hasn’t used the original: Ensembles is a peer-to-peer sync framework for Apple platforms. You add it to your app, point it at your Core Data or SwiftData store, choose a backend, and your data syncs across devices. No server development. No vendor lock-in.

The architecture hasn’t changed. What’s new:

  • Pure Swift 6, with structured concurrency support
  • SwiftData support, alongside Core Data
  • More backends than before
  • Same decentralized, local-first architecture — no central server required

The AI in the room

I know a lot of people are angry about LLMs, and with good reason. I wrote a bleak post in January about what they’re doing to our industry. I stand by that.

But this rewrite would have taken months on my own. I wasn’t going to do that. Ensembles was heading for a quiet retirement. Now it isn’t.

I don’t want to overstate it. I made every architectural decision. I know the Ensembles codebase inside out — I designed it. Claude Code handled the mechanical translation, but it needed constant correction. This isn’t a story about AI replacing a developer. It’s more mundane than that: a tool that sped up a particular kind of grunt work.

I’m not going to tell anyone how to feel about that. But in this case, the result is a framework that wouldn’t exist otherwise.

Give it a try

Ensembles 3 is on GitHub. It’s a beta, so expect rough edges. If you have a Core Data or SwiftData app and want local-first sync without running a server, take a look.