Wiring the Home Screen

From model to cards

HomeView owns its model the standard way β€” @State private var model = HomeViewModel() plus .task { await model.load() } β€” and then simply reads the derived facts. The centerpiece is one branch: if model.upcoming has a value, show the dark NextWalkCard; otherwise show the EmptyWalkCard inviting you to book.

That's an if let living inside body β€” legal because body is @ViewBuilder, as you learned two lessons ago. And the unwrapped up is the named tuple from last lesson: the card reads up.booking and up.walker by field name.