 
     private func handleKeyboard(notification: NSNotification, _ action: KeyboardInfo.Action) {
 
-        if let userInfo = notification.userInfo {
+        guard let userInfo = notification.userInfo else {
+            return
+        }
 
-            let animationDuration: NSTimeInterval = (userInfo[UIKeyboardAnimationDurationUserInfoKey] as! NSNumber).doubleValue
-            let animationCurve = (userInfo[UIKeyboardAnimationCurveUserInfoKey] as! NSNumber).unsignedLongValue
-            let frameBegin = (userInfo[UIKeyboardFrameBeginUserInfoKey] as! NSValue).CGRectValue()
-            let frameEnd = (userInfo[UIKeyboardFrameEndUserInfoKey] as! NSValue).CGRectValue()
+        let animationDuration: NSTimeInterval = (userInfo[UIKeyboardAnimationDurationUserInfoKey] as! NSNumber).doubleValue
+        let animationCurve = (userInfo[UIKeyboardAnimationCurveUserInfoKey] as! NSNumber).unsignedLongValue
+        let frameBegin = (userInfo[UIKeyboardFrameBeginUserInfoKey] as! NSValue).CGRectValue()
+        let frameEnd = (userInfo[UIKeyboardFrameEndUserInfoKey] as! NSValue).CGRectValue()
 
-            let currentHeight = frameEnd.height
-            let previousHeight = keyboardInfo?.height ?? 0
-            let heightIncrement = currentHeight - previousHeight
+        let currentHeight = frameEnd.height
+        let previousHeight = keyboardInfo?.height ?? 0
+        let heightIncrement = currentHeight - previousHeight
 
-            let isSameAction: Bool
-            if let previousAction = keyboardInfo?.action {
-                isSameAction = action == previousAction
-            } else {
-                isSameAction = false
-            }
+        let isSameAction: Bool
+        if let previousAction = keyboardInfo?.action {
+            isSameAction = action == previousAction
+        } else {
+            isSameAction = false
+        }
 
-            keyboardInfo = KeyboardInfo(
-                animationDuration: animationDuration,
-                animationCurve: animationCurve,
-                frameBegin: frameBegin,
-                frameEnd: frameEnd,
-                heightIncrement: heightIncrement,
-                action: action,
-                isSameAction: isSameAction
-            )
-        }
+        keyboardInfo = KeyboardInfo(
+            animationDuration: animationDuration,
+            animationCurve: animationCurve,
+            frameBegin: frameBegin,
+            frameEnd: frameEnd,
+            heightIncrement: heightIncrement,
+            action: action,
+            isSameAction: isSameAction
+        )
     }
 
     func keyboardWillShow(notification: NSNotification) {

                return
            }

            if let info = newValue {
                if !info.isSameAction || info.heightIncrement != 0 {

                    // do convenient animation

                    let duration = info.animationDuration
                    let curve = info.animationCurve
                    let options = UIViewAnimationOptions(rawValue: curve << 16 | UIViewAnimationOptions.BeginFromCurrentState.rawValue)

                    UIView.animateWithDuration(duration, delay: 0, options: options, animations: {

                        switch info.action {

                        case .Show:
                            self.animateWhenKeyboardAppear?(appearPostIndex: self.appearPostIndex, keyboardHeight: info.height, keyboardHeightIncrement: info.heightIncrement)

                            self.appearPostIndex += 1

                        case .Hide:
                            self.animateWhenKeyboardDisappear?(keyboardHeight: info.height)

                            self.appearPostIndex = 0
                        }

                    }, completion: nil)

                    // post full info

                    postKeyboardInfo?(keyboardMan: self, keyboardInfo: info)
                }
            }
        }
    }

            return
        }

        if let keyboardInfo = keyboardInfo where keyboardInfo.action == .Show {
            handleKeyboard(notification, .Show)
        }
    }

