Exercise 2: Showing Priority in Detail View & Disabling Save When Empty — Possible Solution ================================================================================================== // Updated TaskDetailView (reusing TaskRow's own priorityLabel logic): struct TaskDetailView: View { let task: Task let store: TaskStore var priorityLabel: String { switch task.priority { case 1: return "Low" case 2: return "Medium" default: return "High" } } var body: some View { VStack(spacing: 16) { Text(task.title).font(.largeTitle) Text("Priority: \(priorityLabel)").font(.subheadline) Button(task.isDone ? "Mark as Not Done" : "Mark as Done") { store.toggleDone(for: task) } } .padding() .navigationTitle("Task Detail") } } // Updated NewTaskView's toolbar: .toolbar { Button("Save") { store.add(title: title, priority: priority) dismiss() } .disabled(title.isEmpty) } HOW IT WORKS: TaskDetailView gains its own priorityLabel computed property - the same switch-based logic already used in TaskRow, duplicated here rather than shared, since sharing it cleanly would need a small refactor (e.g. moving it onto Task itself) beyond this exercise's own scope - and displays it in a new Text view. The Save button's real .disabled(title.isEmpty) modifier ties the button's own enabled state directly to whether title currently holds any real text. When title is empty, the button appears visibly greyed-out and genuinely cannot be tapped at all - a real, immediate visual signal to the user that something is missing, replacing the original version's own silent no-op behavior (the guard statement that quietly did nothing) with an actual disabled control the user can see and understand. ANSWER: TaskDetailView now computes and displays a priorityLabel using the same switch-based logic as TaskRow. NewTaskView's Save button uses .disabled(title.isEmpty) to visibly grey out and disable itself whenever no title has been entered, replacing the original silent no-op with a real, visible signal that the form isn't ready to submit. WHY THIS WORKS AS AN ANSWER ------------------------------ This correctly extends the detail view with real priority display and replaces silent validation with the real .disabled() modifier, giving the user actual visible feedback rather than an invisible guard clause.