Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SWIFT

swift button

//Declaration
struct Button<Label> where Label : View
//Overview
/*You create a button by providing an action and a label. 
The action is either a method or closure property that does
something when a user clicks or taps the button. The label is
a view that describes the button’s action — for example, by
showing text, an icon, or both:*/

Button(action: signIn) {
    Text("Sign In")
}
/*For the common case of text-only labels, you can use the 
convenience initializer that takes a title string LocalizedStringKey as its first 
parameter,instead of trailing a closure*/
Button("Sign In", action: signIn)
 
PREVIOUS NEXT
Tagged: #swift #button
ADD COMMENT
Topic
Name
9+4 =