SwiftUI on MacOS 11
The objective is to have a SwiftUI SecureField display a Unicode character different than the default bullets (••••••), for example an emoji, a randomly generated character, etc. An important part of the objective is that the actual text input by the user is fully editable and preserved, and accessible in a @State variable, and the masking characters are only displayed, but I don't mind if it's achieved with a TextField or some other View instead.
For example, the vanilla SecureField bullets:
struct ContentView : View {
@State var password : String = ""
var body: some View {
VStack {
SecureField("Password", text: $password)
Button("Transmogrify!") {}
}.padding()
}
}
which results in this:
The objective is to achieve the same behaviour as a SecureField, but displaying a different character like this:
So far I have not been able to come up with a working code example.
I have tried using a plain TextField in conjunction with an explicit Binding<String> to attempt to control the underlying text get/set but due to the nature of bindings that affects the text ultimately stored in password


