Home > Net >  CoreData FetchRequest Increases Compile Time from 3 Seconds to 115 Seconds (Swift 5 with Xcode 14.0
CoreData FetchRequest Increases Compile Time from 3 Seconds to 115 Seconds (Swift 5 with Xcode 14.0

Time:10-11

I'm new to iOS development. If I include the lines

@Environment(\.managedObjectContext) var moc
@FetchRequest(sortDescriptors: [SortDescriptor(\.topic), SortDescriptor(\.id), SortDescriptor(\.tag)]) var facts: FetchedResults<Fact>

then the compile time is 115 seconds, but it is only 3 seconds if I comment them out. If I include only

@Environment(\.managedObjectContext) var moc

it is 10 seconds. (I’ve included images of “build with timing summary” below.) Any suggestions to improve this?

Faster Build Summary Slower Build Summary

CodePudding user response:

I figured it out. I had too many sortDescriptors.

  • Related