Module 10 Β· Bookings: Forms & the Full Loop β Lesson 3 of 4 Β· ~11 min
The Bookings List & Cancelling
Same ViewState song, new verse
The owner's bookings screen is the pattern you've now seen twice: an @Observable view model with a ViewState enum (loading / loaded / failed), a load() that flips through them, and a view that switches on the state. The repo file even says so β its doc comment reads "Same @Observable + ViewState shape as WalkersViewModel."
load() reaches for Module 9's sorted again, with the closure flipped. Home sorted with < β earliest first, because what's next matters there. Here it's bookings.sorted { $0.startTime > $1.startTime } β later dates first, so the newest booking sits at the top. Same tool, and the whole difference between a to-do list and a history is one comparison operator.