0

so I have a TextField and a SecureField, and both will randomly cut off the last character:

TextField("email address", text: $userInfo.email)
                    .disableAutocorrection(true)
                    .autocapitalization(.none)
                    .keyboardType(.emailAddress)
                    .foregroundColor(Color.buttonText)
            }.textFieldStyle(RoundedBorderTextFieldStyle()).padding().padding(.top, 50)

and

 SecureField("password", text: $userInfo.password)
                    .disableAutocorrection(true)
                    .autocapitalization(.none)
                    .foregroundColor(Color.buttonText)
            }.textFieldStyle(RoundedBorderTextFieldStyle()).padding()

for example, if I entered my email as test@gmail.com and my password as password123, my print statements in other parts of the code would say test@gmail.co and password12.

It also says

Binding action tried to update multiple times per frame.

any time I type a key, this might be related. I have only tested on simulators.

edit: user class

class User: ObservableObject{
var id = UUID()
var email : String
var password : String
@Published var loggedIn : Bool 
@Published var image: UIImage = UIImage(named: "user")!

init(email: String = "", loggedIn : Bool = false, password : String = ""){
       self.email = email
       self.loggedIn = loggedIn
       self.password = password
   }

it is an environment object, if that affects it at all.

Raptor
  • 53,206
  • 45
  • 230
  • 366
Ari Steinfeld
  • 366
  • 1
  • 6

0 Answers0