Tour of SQLiteData: Previews

Episode #351 • Jan 19, 2026 • Subscriber-Only

We’ve extended the tour with a few bonus episodes that show how SQLiteData integrates with Xcode previews and tests! No need to painstakingly mock your persistence layer: previews actually hit the database, and the library automatically supplies a mock CloudKit sync engine so you can easily preview how iCloud sharing looks in your UI.

Previous episode
Tour of SQLiteData: Previews
Locked

Unlock This Episode

Our Free plan includes 1 subscriber-only episode of your choice, plus weekly updates from our newsletter.

Sign in with GitHub

Introduction

Brandon

Last week we concluded a 4-part tour of our powerful SQLiteData library. In that series we created a “Scorekeeper” app that allows one to create games, in each game create players, assign images to those players, change the score for each player, and sort the players by their scores.

Stephen

This moderately complex app allowed us to explore most of the core aspects of persistence in the real world and it helped to see how SQLiteData can really shine. With SQLiteData we were able to easily persist and query for our data using type-safe and schema-safe tools. We even stored assets directly in SQLite. Further, all of the data in the database seamlessly synchronized to each device of the user with basically no additional work. And we showed how with just a few lines of code we could even make it possible to share records with other iCloud users for collaboration.

Brandon

And all of that was really cool, but once it was all over we realized that are two really important topics that we did not cover, and they both very closely related. We would like to take a few more episodes to show how one can get the most out of Xcode previews when using SQLiteData and then we want to show how you can still write unit tests on your app’s logic.

Stephen

We are going to start with Xcode previews. Previews are an amazing tool to help you rapidly iterate on the design and behavior of your views, but when you start integrating complex things like synchronization and record sharing into your features it is surprisingly easy to essentially break your previews. After all, in previews there is no access to iCloud servers or any of the CloudKit infrastructure, and so if we implemented that functionality into SQLiteData naively we might make it so that your app is no longer previewable.

Brandon

Well, luckily for us we took a lot of our time perfecting these tools to work well with previews. We even built an in-memory replica of CloudKit’s cloud database API specifically so that the sync engine could continue running during previews and tests, which can give us a lot of confidence that things will behave correctly in production if they behave correctly in previews and tests. And we even recently made improvements to these tools that we will get to show off in this episode.

So, let’s get started with Xcode previews!

Xcode previews


References

Downloads

Get started with our free plan

Our free plan includes 1 subscriber-only episode of your choice, access to 75 free episodes with transcripts and code samples, and weekly updates from our newsletter.

View plans and pricing