I have two localizations in my app (English and Arabic). I have set Keyboard type for many of UITextFields to decimalPad. I need to enforce English only decimal pad for these fields. But when the app language is in Arabic, the keypad is shown in Arabic. It works fine till iOS 12 by subclassing UITextField and override textInputMode. Here is the code:
override var textInputMode: UITextInputMode? {
for mode in UITextInputMode.activeInputModes {
if mode.primaryLanguage?.containsSubString(subString: "en") {
return mode
}
}
return nil
}
In iOS 13 the above code has no effect. I followed Showing the system Emoji keyboard by default on iOS 13. Override textInputContextIdentifier but still no success.
override var textInputContextIdentifier: String? { return "en-US" }
PS: It works fine for other keyboard types - Number, Asci etc. Issue occurs for decimal pad only.