This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Eureka | |
open class _SearchSelectorViewController<Row: SelectableRowType, OptionsRow: OptionsProviderRow>: SelectorViewController<OptionsRow>, UISearchResultsUpdating where Row.Cell.Value: SearchItem { | |
let searchController = UISearchController(searchResultsController: nil) | |
var originalOptions = [ListCheckRow<Row.Cell.Value>]() | |
var currentOptions = [ListCheckRow<Row.Cell.Value>]() | |
open override func viewDidLoad() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add SearchItem protocol to the model (here Project) | |
extension Project: SearchItem { | |
func matchesSearchQuery(_ query: String) -> Bool { | |
return name.lowercased().contains(query.lowercased()) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open class _ComposableSearchablePushRow<T: Equatable, Cell: CellType> : TableSelectorRow<Cell, ComposableSearchableViewController<T>> where Cell: BaseCell, Cell: TypedCellType, Cell.Value == ComposableSearchableItem<T>, T: SearchableItem, T: CustomStringConvertible { | |
public required init(tag: String?) { | |
super.init(tag: tag) | |
onCreateControllerCallback = { [weak self] _ in | |
let controller = ComposableSearchableViewController<T>() | |
controller.searchPlaceholder = self?.searchPlaceholder | |
return controller | |
} |