TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

SwiftData by Example

Join over 90,000 readers today

Solve SwiftData problems faster

Includes free updates for new Swift versions – click to read my update policy

SwiftData by Example is the ultimate SwiftData cookbook, containing hundreds of pages of tips, tricks, techniques, and more to help you make the most of Apple's powerful new data management solution.


If you need SwiftData example code, SwiftData by Example is here to help: from model design, relationships, querying, and more, you'll find your answers here.


All parts of SwiftData are covered, including CloudKit syncing, document-based apps, working with SwiftUI and UIKit, and more.


If you're keen to master your migrations, perfect your performance, or advance your architecture, SwiftData by Example has samples and solutions to help.


You get one big video showing a complete SwiftData project in a real-world setting, plus a bonus video containing challenge solutions and more.

What's in the book

SwiftData by Example is the largest collection of tips, techniques, and solutions for SwiftData, delivering hundreds of pages of instantly applicable solutions for common problems.

While reading, you'll learn all this and more:

  • How to use all the core SwiftData components: ModelContainer, ModelContext, @Attribute, and many more.
  • Designing complex models with relationips and delete rules.
  • Building apps for all of Apple's platforms, including document-based apps.
  • Connecting SwiftData to both SwiftUI and UIKit
  • Adding support for widgets and CloudKit.
  • How to test SwiftData code and make best use of Xcode previews.
  • Debugging SwiftData problems, including common issues and their resolutions, and also inspecting the underlying dagta.
  • How to import data, or ship your app with pre-existing data.
  • Migrating data models as you upgrade your code.
  • Moving projects from Core Data to SwiftData.
  • Separating concerns with MVVM.

Plus: Get a bonus video containing solutions for all three challenges set in the introductory project, along with five bonus challenges that explore more advanced features of SwiftData.

This book is simply packed with tools, tips, and tricks to help you make the most of SwiftData, so if you want to maximize your learning and builds great apps with SwiftData there really is nothing better than SwiftData by Example.

Download full table of contents

Download free sample

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.