mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-12 00:03:27 +01:00
Reorganize AltStore project into UIKit and SwiftUI folders
This commit is contained in:
23
AltStore/SwiftUI/Protocols/Filterable.swift
Normal file
23
AltStore/SwiftUI/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) }
|
||||
}
|
||||
}
|
||||
22
AltStore/SwiftUI/Protocols/NavigationTab.swift
Normal file
22
AltStore/SwiftUI/Protocols/NavigationTab.swift
Normal file
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// NavigationTab.swift
|
||||
// SideStoreUI
|
||||
//
|
||||
// Created by Fabian Thies on 18.11.22.
|
||||
// Copyright © 2022 Fabian Thies. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import SFSafeSymbols
|
||||
|
||||
protocol NavigationTab: RawRepresentable, Identifiable, CaseIterable, Hashable where RawValue == Int {
|
||||
static var defaultTab: Self { get }
|
||||
var displaySymbol: SFSymbol { get }
|
||||
var displayName: String { get }
|
||||
}
|
||||
|
||||
extension NavigationTab {
|
||||
var id: Int {
|
||||
self.rawValue
|
||||
}
|
||||
}
|
||||
11
AltStore/SwiftUI/Protocols/ViewModel.swift
Normal file
11
AltStore/SwiftUI/Protocols/ViewModel.swift
Normal file
@@ -0,0 +1,11 @@
|
||||
//
|
||||
// ViewModel.swift
|
||||
// SideStoreUI
|
||||
//
|
||||
// Created by Fabian Thies on 18.11.22.
|
||||
// Copyright © 2022 Fabian Thies. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
protocol ViewModel: ObservableObject {}
|
||||
Reference in New Issue
Block a user