Saturday, August 13, 2022
HomeiOS Developmentswift - How can I mock SectionedFetchedResults for testing in iOS?

swift – How can I mock SectionedFetchedResults for testing in iOS?

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(, 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)



Please enter your comment!
Please enter your name here

Most Popular

Recent Comments