Skip to content

Instantly share code, notes, and snippets.

@hirauchg
Created August 17, 2020 12:48
Show Gist options
  • Save hirauchg/faa0559c5418377a31c08bf3214c0a4b to your computer and use it in GitHub Desktop.
Save hirauchg/faa0559c5418377a31c08bf3214c0a4b to your computer and use it in GitHub Desktop.
SecureFieldの実装
import SwiftUI
struct ContentView: View {
@State private var password = ""
@State private var inputText = ""
var body: some View {
VStack {
SecureField("パスワードを入力してください。", text: $inputText, onCommit: {
self.password = self.inputText
})
.textFieldStyle(RoundedBorderTextFieldStyle())
.keyboardType(.alphabet)
.padding()
Text(password)
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment