 
     func keyboardWillHide(notification: NSNotification) {
 
-        if UIApplication.sharedApplication().applicationState != .Active {
+        guard UIApplication.sharedApplication().applicationState != .Background else {
             return
         }
 


    var keyboardInfo: KeyboardInfo? {
        willSet {
            if UIApplication.sharedApplication().applicationState != .Active {
                return
            }


    
    func keyboardWillChangeFrame(notification: NSNotification) {

        guard UIApplication.sharedApplication().applicationState != .Background else {
            return
        }

