Skip to content
Join us for Free for Full Access to site Content

SecureField – SwiftUI

SecureField in SwiftUI – a control which allows the user to enter private text securely.

It is similar to TextField, but in SecureField all the characters entered by the user are masked for privacy.

Here is the example of using SecureField in your SwiftUI App

SecureField Example

    @State private var password: String = ""
    
    var body: some View {
        VStack {
            
            SecureField("Password", text: $password)
                .padding(.all, 20)
                .multilineTextAlignment(.center)
            
            Text("Result: \(password)")
            
        }
    }
    

Learn more about SwiftUI using SwiftUI Tutorials by the AppMakers

SecureField Documentation

If the code is deprecated or will change in the future, please visit the official SwiftUI Documentation.

Leave a comment to Submit the NEW and USEFUL code related to the topic of this post. Submit a brief and useful code only.

Back To Top
Search

Get Latest App Development News, Tips and Tutorials

* indicates required


Send this to a friend