     private var context: NSManagedObjectContext!
     private var crudDelegate: CrudViewControllerCRUDDelegate!
     private var tableViewDelegate: CrudViewControllerUITableViewDelegate!
+    private var searchDelegate: CrudViewControllerSearchDelegate!
     private var hideAddItemRow = false
     private var tableUpdates: [String: [IndexPath]]?
     var logger: LogController?
 
-    init(fetchRequest: NSFetchRequest<NSFetchRequestResult>, context: NSManagedObjectContext, crudDelegate: CrudViewControllerCRUDDelegate, tableViewDelegate: CrudViewControllerUITableViewDelegate) {
+    init(fetchRequest: NSFetchRequest<NSFetchRequestResult>, context: NSManagedObjectContext, crudDelegate: CrudViewControllerCRUDDelegate, tableViewDelegate: CrudViewControllerUITableViewDelegate, searchDelegate: CrudViewControllerSearchDelegate) {
         super.init(nibName: nil, bundle: nil)
         self.crudDelegate = crudDelegate
         self.tableViewDelegate = tableViewDelegate
+        self.searchDelegate = searchDelegate
         self.context = context
         setUpFetchedResultsController(withFetchRequest: fetchRequest)
         setUpUI()

    func crudViewController(crudViewController: CrudViewController, selected object: NSFetchRequestResult)
    func crudViewController(crudViewController: CrudViewController, canEdit object: NSFetchRequestResult) -> Bool
    func crudViewController(crudViewController: CrudViewController, editActionsFor tableView: UITableView) -> [UITableViewRowAction]?
}

class CrudViewController: UIViewController {

extension CrudViewController: UITextFieldDelegate {

    func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {
        if tableViewDelegate.crudViewControllerShouldShowAddItemRow(crudViewController: self) {
            setTableView(toHideAddItemRow: true)
        }
        return true
    }

    func textFieldShouldEndEditing(_ textField: UITextField) -> Bool {
        if tableViewDelegate.crudViewControllerShouldShowAddItemRow(crudViewController: self) {
            setTableView(toHideAddItemRow: false)
        }
        return true
    }

