100 Days of SwiftUI
2026-06-28
Project 11, part 3
Finishing up the main part of the Bookworm app
Showing book details
- making a
DetailView#Previewof SwiftData requires some setup — basically you have to set up the whole system because otherwise the Canvas gets unhappy
Sorting SwiftData queries using SortDescriptor
- if you don’t choose a sort order then the user may get an unpredictable experience
- can do multi-sort using
SortDescriptor- but only a few properties, with or without reversing the order within the list
- you make an array of
SortDescriptor(\DataModel.field, order: .reverse)in the@Querye.g.
@Query(sort: [ SortDescriptor(\Book.title), SortDescriptor(\Book.author) ]) var books: [Book]
Though I don’t understand why anyone would want to sort by title first
Deleting from a SwiftData query


I’m only watching the videos for the puppers
- deleting items from SwiftData is not much more complicated than removing items from an array
What I realllllly want to be able to do is EDIT MY ENTRIES. We haven’t discussed that at all in any of these “data” apps.