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

    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 setTableView(toHideAddItemRow hideAddItemRow: Bool) {
        guard
            let searchCancelButton = searchCancelButton,
            let cancelButtonBlurView = cancelButtonBlurView,
            let searchCancelButtonWidthConstraint = searchCancelButtonWidthConstraint,
            let searchCancelButtonLeadingConstraint = searchCancelButtonLeadingConstraint
        else { return }

        DispatchQueue.main.async {
            let constraintAnimations = {
                searchCancelButtonWidthConstraint.constant = hideAddItemRow ? 60 : 0
                searchCancelButtonLeadingConstraint.constant = hideAddItemRow ? 20 : 0
                self.view.layoutIfNeeded()
            }

            let alphaAnimations = {
                searchCancelButton.alpha = hideAddItemRow ? 1 : 0
                cancelButtonBlurView.alpha = hideAddItemRow ? 1 : 0
            }

            if hideAddItemRow {
