All great answers. But in Swift you can override methods and variables defined in parent class (UIResponder
) in an extension. So it's not necessary to subclass. And it's nice to replace the for
loop with a more swift like one-liner.
public extension UITextField { override var textInputMode: UITextInputMode? { return UITextInputMode.activeInputModes.filter { $0.primaryLanguage == "emoji" }.first ?? super.textInputMode }}
Instead of "emoji" probably will be something like Utils.currentAppLanguage