100 Days of SwiftUI

Day 58

2026-07-01

Project 12, part two

Lots going on here!

Dynamically sorting and filtering @Query with SwiftUI

  • something something use an underscore to query a query?
  • .distantPast date modifier is an interesting way to check roughly contemporary dates without having to be explicit about it
  • tag() modifier lets us rename list items in the UI (so they don’t have to be the same as what is in the code)

Relationships with SwiftData, SwiftUI, and @Query

  • Relationships → 1:Many, Many:1, you know the drill
  • SwiftData will handle stuff, as long as you tell it exactly what you want

Again a topic that I feel Gingery about. I will likely need to do a lot of review before I get it.

just let SwiftData do its thing until you have a reason to do otherwise!

  • use @Relationship to tell SwiftData what to do with the “extra” data if you, say, delete an item.
    • if you don’t say, it will keep all the “extra” data (.nullify)
    • you can use .cascade to delete all the stuff associated with the original item (including all child items)

So what happens if a child item is related to two parent items?

Syncing SwiftData with CloudKit

Requires an active Apple developer account; apparently the free account doesn’t work (iCloud doesn’t show up as a capability for me)

Sadness from Inside Out crying