Posts

Showing posts from April, 2021

SwiftUI - BUTTON

BUTTON Button is used to respond to click events. Example: Button ( action : { print ( "Tap" ) }) { Text ( "I'm a Button" ) }

SiwftUI - WEBIMAGE

WEBIMAGE webImage is used to download the web image, use the URLSession to download the original Image after successful download; you can also use Kingfisher in the downloadWebImage function . Example: var body : some View { Image ( uiImage : self . uiImage ?? placeholderImage ) . resizable () . onAppear ( perform : downloadWebImage ) . frame ( width : 80 , height : 80 , alignment : . center ) . onTapGesture { print ( "Tap " ) } }

SiwftUI - IMAGE

  IMAGE The  Image  control is used to display images, example: Image ( "icon" ) . resizable () . frame ( width : 100 , height : 100 , alignment : . center )

SwiftUI - TEXTFIELD

TEXTFIELD TextField is used to add a normal input box, which is often used as a text input. Example: TextField ( self . $ name , placeholder : self . nameText , onEditingChanged : { changed in print ( "onEditing: \( changed ) " ) }) { print ( "userName: \( self . name ) " ) self . endEditing ( true ) }} . padding ( 10 ) . frame ( height : 50 ) . textFieldStyle ( RoundedBorderTextFieldStyle ()) . padding ( EdgeInsets ( top : 0 , leading : 20 , bottom : 0 , trailing : 20 ))

SwiftUI - TEXT

TEXT Text is used to display one or more lines of text content with the same effect as UILabel, but it is even better. If you want to create Text, just create it with Text("SwiftUI"); With chained syntax, you can also add multiple attributes to the text, such as fonts, colors, shadows, spacing between top left and right, and so on. Example: Text ( "SwiftUI" ) . foregroundColor ( . orange ) . bold () . font ( . system ( . largeTitle )) . fontWeight ( . medium ) . italic () . shadow ( color : . black , radius : 1 , x : 0 , y : 2 )