Wrap up: our SwiftData project is complete
Wrap up: our SwiftData project is complete 관련
Updated for Xcode 15
This introductory project was designed to teach you the absolute fundamentals of building with SwiftData, so you've met models, model containers, model contexts, queries, sort descriptors, predicates, relationships, and more.
Each of those things have significantly more power than can be shown off in a small tutorial like this one, but I hope you can appreciate how powerful SwiftData is, and how it makes it even complex data management easy.
The rest of this book is dedicated to showing off much more of the power of SwiftData, but you should also keep in mind that it's just going to keep growing and growing as it matures in the future.
And if you’d like to see my completed version of this project, you can find it here on GitHub: twostraws/iTour
.
Challenges
One of the best ways to learn is to write your own code as often as possible, so here are three ways you should try your new knowledge to make sure you fully understand what’s going on:
- Add swipe to delete for sights.
- Use an array of sort descriptors to initialize
DestinationListingView
, with the first sort being the one the user chose and the second sort being a sensible alternative – arrival date then name, for example. - Add a second picker menu to the toolbar in
ContentView
, allowing the user to toggle showing all destinations or only ones that are in the future.
Hacking with Swift+ subscribers can find the solutions to these three challenges – plus a huge exploration of bonus challenges – at this link: https://hackingwithswift.com/plus/solutions/itour.