mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 14:53:25 +01:00
[ADD] Search bar for BrowseView on iOS 15
This commit is contained in:
committed by
Joe Mattiello
parent
0c034b61d9
commit
0e7083539d
23
AltStore/Protocols/Filterable.swift
Normal file
23
AltStore/Protocols/Filterable.swift
Normal file
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// Filterable.swift
|
||||
// SideStore
|
||||
//
|
||||
// Created by Fabian Thies on 01.12.22.
|
||||
// Copyright © 2022 SideStore. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
protocol Filterable {
|
||||
func matches(_ searchText: String) -> Bool
|
||||
}
|
||||
|
||||
extension Collection where Element: Filterable {
|
||||
func matches(_ searchText: String) -> Bool {
|
||||
self.contains(where: { $0.matches(searchText) })
|
||||
}
|
||||
|
||||
func items(matching searchText: String) -> [Element] {
|
||||
self.filter { $0.matches(searchText) }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user