May 2024
Beginner to intermediate
446 pages
10h 33m
English
So far, we have explored how to create complex views in SwiftUI by adding more elements, but all these views have been static; that is, they don’t respond to user interaction such as tap events. This limitation would be just acceptable if we only needed to draw pretty pixels on a user’s mobile screen, but we normally want those pretty pixels to respond dynamically to the user’s interactions and be “responsive.” By user interaction, we mean whatever gestures the user may perform in order to control the UI (e.g., tapping on a button, pinches, sliding, etc.).
In SwiftUI, views are created by means of structs, which are normally immutable. So, how can we make these views respond to user actions and change ...