Saturday, November 7, 2026
HomeiOS Developmentios - Forestall SecureField From Auto Clearing SwiftUI

ios – Forestall SecureField From Auto Clearing SwiftUI

[ad_1]

I’m utilizing mixture of TextField and SecureField in my Login display screen of app, consumer can click on eye button to point out and conceal textual content utilizing this code:

ZStack(alignment: .trailing){
            if isSecured{
                SecureField(placeholder, textual content: $textual content)
                    .padding(.trailing, 35)
            }else{
                TextField(placeholder, textual content: $textual content)
                    .padding(.trailing, 35)
            }
            
            Button {
                isSecured = !isSecured
            } label: {
                Picture(systemName: isSecured ? "eye.slash" : "eye")
            }

        }
        .background(
            Shade.grey
                .body(top: 0.5)
                .padding(.prime, 40)
        )

So, when consumer click on eye button to point out password after which once more click on eye button after it to cover password lead SecureField to auto-clear password on getting into textual content, is there any approach in order that password does not auto-clear? thanks

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments