0

I have a UIView subclass which conforms to UIKeyInput protocol. I want to set the keyboard type to numberPad. Unfortunately, setting this property does nothing.

var keyboardType: UIKeyboardType {
    .numberPad
}

Compiler warns me with the following description:

Property 'keyboardType' nearly matches optional requirement 'keyboardType' of protocol 'UITextInputTraits'

Therefore, I know that this property does not refer to the UIKeyInput protocol. I was looking for other protocols or classes called UIKeyInput, but I didn't find any.

Do you have any suggestion what else can cause this issue?

4

1 回答 1

1

As documentation show you should provide getter and setter for this property.

optional var keyboardType: UIKeyboardType { get set }
于 2020-05-12T13:06:32.293 回答