Creating a Tappable Button
Build a Button with a label and an action.
Why Buttons Matter
Most apps come alive when you tap something. A Button is the simplest way to let people trigger an action in SwiftUI. 👆
The Button View
A Button is just a view, like Text or Image. You place it in your body and SwiftUI draws a tappable control for you.
Button("Tap me") {
print("Tapped!")
}All lessons in this course
- Creating a Tappable Button
- Styling Buttons
- Running Code on Tap
- Disabling & Enabling Buttons