SwiftData Quick Start Guide
A guide for helping you setup SwiftData with an iOS17+ project.


A guide for helping you setup SwiftData with an iOS17+ project.
SubscribeIf you are looking for a SwiftUI specific guide, consult the guide below.
What is SwiftData?
Swift Data is a modern framework for on-device data storage, modelling and management intended to replace Core Data and provides a Swift-like API that integrates well with Swift UI.
Requirements
In order for your app to work with SwiftData you must:
- Have an iPhone, iPad or Mac running iOS17, iPadOS17 or MacOS13 or higher.
- Have an Mac running XCode 15 or higher.
- Have iOS17 installed on a Mac running Xcode 15 or higher.
Apple Developer Resources
We recommend that you consult all of WWDC's videos on Swift Data.
Tutorials
We recommend completing the tutorials linked below to get up to speed with the basics of SwiftData.
Setup
How to create or access a SwiftData Persistent Container in SwiftModelling
How to create a SwiftData Model in SwiftHow to add structs or enums to SwiftData modelsHow to create a SwiftData model variable that does not persistOperations
Get
How to get all SwiftData objects in SwiftHow to get an object from SwiftData in SwiftHow to know if an object already exists in SwiftDataCreate
How to add an object to SwiftData in SwiftUpdate
How to update an object in SwiftData in SwiftDelete
How to delete an object from SwiftData in SwiftHow to delete all objects from SwiftData in SwiftHow to make sure SwiftData deletes objects when app terminatesErrors
SwiftData crashes when trying to access a deleted objectHow to solve "No exact matches in call to instance method 'setValue'"Frequently Asked Questions (FAQ)
Why doesn't XCode let me run the app on an iPhone or iPad?
You need to install iOS17 on XCode for you to be able to run development apps on your iPhone or iPad.