简体   繁体   中英

Swift: UITextInput protocol does not conform

So I have a login screen, and it works, however my debugger is throwing the same error over and over again during typing and I can't find out WHY it's doing this.

[Assert] View <(null):0x0> does not conform to UITextInput protocol

And here's my code

let emailTextField: UITextField = {
    let textField = UITextField()
    textField.placeholder = "emailaddress".localized
    textField.translatesAutoresizingMaskIntoConstraints = false
    textField.backgroundColor = .white
    textField.font = UIFont.init(name: "AlegreyaSans-Regular", size: 18)
    textField.autocapitalizationType = .none
    textField.textContentType = .emailAddress
    textField.keyboardType = .emailAddress
    let paddingView: UIView = UIView(frame: CGRect(x: 0, y: 0, width: 10, height: 20))
    textField.leftView = paddingView
    textField.leftViewMode = .always
    return textField
}()

It renders out ok, and it works fine, however the errors are stacking up while typing.

not sure if this helps you at all but I had a simile issue when I was trying to get my keyboard to be hidden when a user hits return. what I did was sent the textField's delegate to textField.delegate = self

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM