Skip to content

Instantly share code, notes, and snippets.

@gotelgest
gotelgest / SearchPushRow.swift
Last active February 24, 2024 14:35
SearchPushRow for Eureka 4.0.1 (Swift 4)
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() {
@noefroidevaux
noefroidevaux / Project.swift
Created September 7, 2017 13:27
SearchPushRow for Eureka 3.0 (Swift 3.1)
// Add SearchItem protocol to the model (here Project)
extension Project: SearchItem {
func matchesSearchQuery(_ query: String) -> Bool {
return name.lowercased().contains(query.lowercased())
}
}
@bithavoc
bithavoc / eureka_swift_3:composable_search_row.swift
Last active April 23, 2024 13:32
Eureka Swift 3 Composable Search Row
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
}