Model SwiftUI screen state

A user changes a title and taps Cancel. Which title should the list show?

Examples

Example 1

Input
Saved: Maps. Draft: Stars. Action: Cancel.
Expected output
Maps

Hints and solution

Hint 1

Identify when the draft should replace the saved record.

Reveal worked answer

Show the saved title. Cancel discards the draft, so the edit never updates the stored record.

Back to the lesson