Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect when user changes keyboards?

Is there some way to detect when the user changes keyboard types, specifically to the Emoji keyboard in this case?

like image 487
Apollo Avatar asked Jun 11 '14 16:06

Apollo


1 Answers

Swift 4:

NotificationCenter.default.addObserver(self,
     selector: #selector(FirstViewController.changeInputMode(_:)),
     name: NSNotification.Name.UITextInputCurrentInputModeDidChange, object: nil)

func changeInputMode(_ notification: Notification) 
    {
        let inputMethod = UITextInputMode.activeInputModes.description
        print("keyboard changed to \(inputMethod.description)")
    }
like image 52
fugu2 Avatar answered Oct 09 '22 07:10

fugu2