Sorry if the question has been already answered. I'm new to Swift, and I want to create a simple fixed-size TextField
for one-time password:
TextField("******", text: self.$otp)
.padding()
.textContentType(.oneTimeCode)
.keyboardType(.numberPad)
I was hoping to find a configuration parameter similar to <input size="6"/>
in HTML so that the engine would automatically compute the TextField
's size for N
characters.
Is there a simple solution to this without jumping through hoops like using ZStack
s and spawning N
text fields as I saw some enthusiasts were suggesting?