Button
Define actions for user taps.
Button
Define actions for user taps.
0
0
Checkbox to mark video as read
Mark as read

The most common way of getting some interaction from our App's users is through buttons.

There are many options to create a button, in this first article about buttons we'll explore the simplest way:

This component requires two things, action and label, which will be define between { }.

Button(action: {
  print("Button has been tapped")
}, label: {
  Text("Tap here")
})

Action

All the code included here will be ignored until the user taps the button. In that moment those lines between action's { } will execute. In our case we'll see a message in the console thanks to print() command.



Label

On the other side, we added a Text as a label, but you could use any UI component here.

course

Quiz Time!

0 Comments

Join the community to comment
Sign Up
I have an account
Be the first to comment

Accept Cookies

We use cookies to collect and analyze information on site performance and usage, in order to provide you with better service.

Check our Privacy Policy