I’m struggling to work how I can use a protocol to characterize the core knowledge sort, SectionFetchedResults
to allow me so as to add snapshot testing for my iOS SwiftUI app.
Beneath is the code and I’m making an attempt to cross gamers
into SquadView
utilizing a protocol to characterize it.
What do you assume I may do?
import SwiftUI
struct SquadContainerView: View {
@Setting(.managedObjectContext) var viewContext
@SectionedFetchRequest var gamers: SectionedFetchResults<Int16, Participant>
personal let crew: Teamable
init(crew: Teamable) {
let predicate = NSPredicate(format: "%Okay == %@", #keyPath(Participant.crew.id), crew.id as CVarArg)
_players = SectionedFetchRequest<Int16, Participant>(sectionIdentifier: .place, sortDescriptors: [SortDescriptor(.shirtNumber)], predicate: predicate)
self.crew = crew
}
var physique: some View {
SquadView(viewModel: .init(crew: crew,
playerService: PlayerService(viewContext),
teamService: TeamService(viewContext)),
gamers: gamers)
}
}