Build: MainActor UI Update Demo
This screen shows a label and a button. When the button is tapped, it simulates a background task that updates the label text safely on the main thread using @MainActor.
Target UI
------------------------- | MainActor UI Update Demo | |-----------------------| | | | Label: Waiting... | | | | [ Update Label ] | | | -------------------------
Display a label with initial text 'Waiting...'
Add a button labeled 'Update Label'
When button is tapped, simulate a 2-second background task
After task completes, update label text to 'Updated on MainActor!' safely on main thread using @MainActor