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


    private func handleKeyboard(notification: NSNotification, _ action: KeyboardInfo.Action) {

        if let userInfo = notification.userInfo {

            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 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
            )
        }
    }

    func keyboardWillShow(notification: NSNotification) {

                return
            }

            guard let info = newValue else {
                return
            }

            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: { [weak self] in

                    guard let strongSelf = self else { return }

                    switch info.action {

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

                        strongSelf.appearPostIndex += 1

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

                        strongSelf.appearPostIndex = 0
                    }

                }, completion: nil)

                // post full info

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