SwiftData tutorial: Building a complete project
SwiftData tutorial: Building a complete project êŽë š
Updated for Xcode 15
This is a complete, free SwiftData tutorial designed to take you through all its core functionality in a single project. Itâs aimed at people who have existing programming experience with SwiftUI, but all the SwiftData APIs and techniques are explained in detail so newcomers can to follow along.
Important
This was written for iOS 17.0, so youâll need at least Xcode 15.0 to follow along. This is available as a free download from the Mac App Store if you donât already have it.
The project weâll be making is called iTour, and is a travel app that helps sightseers plan their vacation sightseeing. Users will be able to add a list of places they want to visit on their vacation, sort and search those destinations, then also add individual sights inside each place.
Iâve designed the project specifically so that it covers a variety of core SwiftData techniques to give you a good grounding in how things work. You'll learn how to define Swift data models, how to link models together using relationships, how to query and display data in SwiftUI, how to add sorting and filtering, and more.
Of course, weâre also building a real project at the same time â itâs going to be busy!
Note: If youâd like to see my completed version of this project, you can find it here on GitHub: twostraws/iTour
.
To get started, please create a new iOS project in Xcode called âiTourâ, choosing the App template. You should also select SwiftUI for the Interface, but please leave all the checkboxes unchecked and make sure the Storage option is set to None.