Home > AI > IOS > SwiftUI >

SecureField

Example(Apple Official)

struct ContentView: View {
    @State private var username: String = ""
    @State private var password: String = ""

    var body: some View {
        TextField(
            "User name (email address)",
            text: $username)
            .autocapitalization(.none)
            .disableAutocorrection(true)
            .border(Color(UIColor.separator))
        
        SecureField( "Password", text: $password) {
            print(username)
            print(password)
        }
        .border(Color(UIColor.separator))
    }
}

Leave a Reply