Ferrite-backup/Ferrite/Views/CommonViews/DynamicFetchRequest.swift
Skitty 5d97c7511f Sources: Fix source searching (#8)
- Make searching case insensitive
- Fix catalog title not hiding when searching an installed source name
- Cancelling a search doesn't add an installed source to the catalog
- Add dynamic predicate changing for iOS 14 and up instead of restricting
to iOS 15
- Migrate updated source fetching to the source model
- Change how filtering works to adapt with the dynamic predicate
changes

Signed-off-by: kingbri <bdashore3@proton.me>
Co-authored-by: kingbri <bdashore3@proton.me>
2022-09-07 09:51:06 -04:00

26 lines
596 B
Swift

//
// DynamicFetchRequest.swift
// Ferrite
//
// Created by Brian Dashore on 9/6/22.
//
import CoreData
import SwiftUI
struct DynamicFetchRequest<T: NSManagedObject, Content: View>: View {
@FetchRequest var fetchRequest: FetchedResults<T>
let content: (FetchedResults<T>) -> Content
var body: some View {
content(fetchRequest)
}
init(predicate: NSPredicate?,
@ViewBuilder content: @escaping (FetchedResults<T>) -> Content)
{
_fetchRequest = FetchRequest<T>(sortDescriptors: [], predicate: predicate)
self.content = content
}
}