     }
 
     func searchBarCancelButtonClicked(_ searchBar: UISearchBar) {
-        filteredObjects = []
+        filteredObjects = nil
     }
 
     func willPresentSearchController(_ searchController: UISearchController) {

}

internal extension Selector {
    static let selectAll = #selector(RBSRealmObjectsBrowser.actionSelectAll(_:))
    static let togglePreview = #selector(RBSRealmObjectsBrowser.actionTogglePreview(_:))
//    static let edit = #selector(RBSRealmObjectsBrowser.actionToggleEdit(_:))
}

extension RBSRealmObjectsBrowser: UITableViewDelegate {
    public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
//        if isEditMode && !selectAll {
//            if let cell = tableView.cellForRow(at: indexPath) {
//                cell.accessoryType = .checkmark
//                cell.tintColor = RealmStyle.tintColor
//            }
//            selectedObjects.append(data()[indexPath.row])
//        } else {
//            tableView.deselectRow(at: indexPath, animated: true)
//            let viewController = RealmPropertyBrowser(object: data()[indexPath.row], engine: engine)
//
//            if let searchController = searchController {
//                if searchController.isActive {
//                    searchController.dismiss(animated: true) { [weak self] in
//                        self?.navigationController?.pushViewController(viewController, animated: true)
//                    }
//                } else {
//                    navigationController?.pushViewController(viewController, animated: true)
//                }
//            } else {
//                navigationController?.pushViewController(viewController, animated: true)
//            }
//        }
    }

    public func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath) {
        if isEditMode {
            tableView.cellForRow(at: indexPath)?.accessoryType = .none
            var index = 0
            for object in selectedObjects {
                var hasFoundObject = false
                guard let objects = objects else { return }
                if object == objects[indexPath.row] {
                    hasFoundObject = true
                    selectedObjects.remove(at: index)
                }
                if hasFoundObject {
                    index = 0
                } else {
                    index += 1
                }
            }
        }
    }
}


            searchController.searchResultsUpdater = self
            searchController.searchBar.delegate = self
            searchController.delegate = self
            self.definesPresentationContext = true
            searchController.hidesNavigationBarDuringPresentation = false
            searchController.definesPresentationContext = true
            searchController.dimsBackgroundDuringPresentation = false
