Created
August 17, 2020 12:48
-
-
Save hirauchg/faa0559c5418377a31c08bf3214c0a4b to your computer and use it in GitHub Desktop.
SecureFieldの実装
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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