SwiftUI - SecureField Example

 Example of using a SecureField in SwiftUI - SecureField is used for password



import SwiftUI


struct ContentView: View {

    @State private var text: String = ""


    var body: some View {

        VStack {

            SecureField("Enter your password", text: $text)

                .textFieldStyle(RoundedBorderTextFieldStyle())

                .padding()

            

        }

    }

}


struct ContentView_Previews: PreviewProvider {

    static var previews: some View {

        ContentView()

    }

}



Output:






SwiftUI - SecureField Example SwiftUI - SecureField Example Reviewed by KIRIT MODI on 23:26:00 Rating: 5

No comments:

Powered by Blogger.