我想实现在 SecureField 中显示和隐藏密码的功能。下面是 SecureField 的代码,我添加了按钮,将检测到该按钮以显示和隐藏 SecureField 中的文本。但是 swiftUI 没有类似于isSecureTextEntry 的功能 除了在 Textfield 和 SecureField 之间切换之外还有其他方法吗
SecureField(placeholder, text: $textValue, onCommit: {
onReturn?()
})
.onTapGesture {
onBegin?()
}
.keyboardType(keyboardType)
.font(Font.label.bodyDefault)
.disableAutocorrection(true)
.frame(maxWidth: .infinity, maxHeight: 40)
.padding(.leading)
Run Code Online (Sandbox Code Playgroud)