SwiftData Quick Start Guide

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

Oscar de la Hera Gomez
Written by Oscar de la Hera Gomez
First published on 09/11/2023 at 11:40
Last Updated on 10/18/2024 at 15:49
<p>Three flowers that represent Swift, Swift Data and Xcode. The text "SwiftData Quick Start Guide" sits beneath them.</p>

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

Subscribe

If you are looking for a SwiftUI specific guide, consult the guide below.

SwiftUI SwiftData Quick Start Guide

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.

WWDC 2023: Meet SwiftData

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.
Download the latest version of XCodeDownload the latest version of iOS

Apple Developer Resources

We recommend that you consult all of WWDC's videos on Swift Data.

Meet SwiftDataBuild an app with SwiftDataModel your schema with SwiftDataDive Deeper into SwiftData

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 Swift

Modelling

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 persist

Operations

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 SwiftData

Create

How to add an object to SwiftData in Swift

Update

How to update an object in SwiftData in Swift

Delete

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 terminates

Errors

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.

Any Questions?

We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.
SubscribeContact UsVisit our BlogView our ServicesView our Work

Partner with us

We would love to get to know you and see how we can help your organization with its goals and needs.
Let's Talk

Stay Informed

Get occasional updates about our company, research, and product launches.
Subscribe