     }
 
     func setTableView(toHideAddItemRow hideAddItemRow: Bool) {
+        guard
+            let searchCancelButton = searchCancelButton,
+            let cancelButtonBlurView = cancelButtonBlurView,
+            let searchCancelButtonWidthConstraint = searchCancelButtonWidthConstraint,
+            let searchCancelButtonLeadingConstraint = searchCancelButtonLeadingConstraint
+        else { return }
+
         DispatchQueue.main.async {
             let constraintAnimations = {
-                self.searchCancelButtonWidthConstraint.constant = hideAddItemRow ? 60 : 0
-                self.searchCancelButtonLeadingConstraint.constant = hideAddItemRow ? 20 : 0
+                searchCancelButtonWidthConstraint.constant = hideAddItemRow ? 60 : 0
+                searchCancelButtonLeadingConstraint.constant = hideAddItemRow ? 20 : 0
                 self.view.layoutIfNeeded()
             }
 
             let alphaAnimations = {
-                self.searchCancelButton.alpha = hideAddItemRow ? 1 : 0
-                self.cancelButtonBlurView.alpha = hideAddItemRow ? 1 : 0
+                searchCancelButton.alpha = hideAddItemRow ? 1 : 0
+                cancelButtonBlurView.alpha = hideAddItemRow ? 1 : 0
             }
 
             if hideAddItemRow {

    private var fetchedResultsController: NSFetchedResultsController<NSFetchRequestResult>!
    private var tableView = UITableView(frame: .zero, style: .plain)
    private var customCellReuseIdentifier: String?
    private var searchField: UITextField!
    private var searchContainer: CrudSearchContainer!
    private var searchCancelButton: UIButton!
    private var cancelButtonBlurView: UIVisualEffectView!
    private var searchCancelButtonWidthConstraint: NSLayoutConstraint!
    private var searchCancelButtonLeadingConstraint: NSLayoutConstraint!
    private var context: NSManagedObjectContext!
    private var crudDelegate: CrudViewControllerCRUDDelegate!
    private var tableViewDelegate: CrudViewControllerUITableViewDelegate!


    func cancelSearch() {
        resetSearch()
        searchField?.text = nil
        searchField?.resignFirstResponder()
    }

}
