kkiermasz
kkiermasz

Reputation: 463

UIKeyInput keyboard type protocol requirement does not match

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?

Upvotes: 0

Views: 375

Answers (1)

Daniel Sumara
Daniel Sumara

Reputation: 2264

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

optional var keyboardType: UIKeyboardType { get set }

Upvotes: 1

Related Questions