I need to define a generic SwiftUI view that can accept sectioned fetch results for different CoreData entities, but I'm not sure how to define the generic view.
In the example below, I have two sectioned fetch results defined for Patient
and Doctor
entities. I need to be able to pass them to the generic view.
@SectionedFetchRequest(
sectionIdentifier: \.sectionTitle,
sortDescriptors: Patient.nameSortDescriptors(), animation: .default)
private var patients: SectionedFetchResults<String, Patient>
@SectionedFetchRequest(
sectionIdentifier: \.sectionTitle,
sortDescriptors: Doctor.nameSortDescriptors(), animation: .default)
private var doctors: SectionedFetchResults<String, Doctor>
GenericView(items: patients)
GenericView(items: doctors)
struct GenericView: View {
let items: ?????
}