             }
         }
     }
+    
+    // MARK: - Prepare for draw table result
+    
+    fileprivate func prepareDrawTableResult() {
+        guard let frame = self.superview?.convert(self.frame, to: UIApplication.shared.keyWindow) else { return }
+        if let keyboardFrame = keyboardFrame {
+            var newFrame = frame
+            newFrame.size.height += theme.cellHeight
+            
+            if keyboardFrame.intersects(newFrame) {
+                direction = .up
+            } else {
+                direction = .down
+            }
+            
+            redrawSearchTableView()
+        }
+    }
 }
 
 extension SearchTextField: UITableViewDelegate, UITableViewDataSource {

        }
    }
    
    fileprivate func filterCurrentText() {
        
    }
    
    // Handle keyboard events
    open func keyboardWillShow(_ notification: Notification) {
        keyboardFrame = ((notification as NSNotification).userInfo![UIKeyboardFrameEndUserInfoKey] as! NSValue).cgRectValue
        interactedWith = true
        
        if let keyboardFrame = keyboardFrame {
            var newFrame = frame
            newFrame.size.height += theme.cellHeight
            
            if keyboardFrame.intersects(newFrame) {
                direction = .up
            } else {
                direction = .down
            }
            
            redrawSearchTableView()
        }
    }
    
    open func keyboardWillHide(_ notification: Notification) {
        direction = .down
        redrawSearchTableView()
    }
    
    open func typingDidStop() {

                shadowView!.frame = shadowFrame
            } else {
                let tableHeight = min((tableView.contentSize.height + positionGap), (UIScreen.main.bounds.size.height - frame.origin.y - theme.cellHeight * 2))
                UIView.animate(withDuration: 0.2, animations: { [weak self] in
                    self?.tableView?.frame = CGRect(x: frame.origin.x + 2, y: (frame.origin.y - tableHeight + positionGap), width: frame.size.width - 4, height: tableHeight)
                    self?.shadowView?.frame = CGRect(x: frame.origin.x + 3, y: (frame.origin.y + 3), width: frame.size.width - 6, height: 1)
                })
            }
            
            superview?.bringSubview(toFront: tableView)
