UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

SectionedFetchRequest Sort descriptors Xcode performance impact

Forums > SwiftUI

I use SectionedFetchRequests to show my CoreData in ordered lists grouped by some criteria, as Paul explains here: https://www.hackingwithswift.com/books/ios-swiftui/sorting-fetch-requests-with-sortdescriptor

In this article he says: "Having a second or even third sort field has little to no performance impact unless you have lots of data with similar values". But...

This is one of my requests:

@SectionedFetchRequest(sectionIdentifier: \.classWeekDay!, sortDescriptors: [SortDescriptor(\.classWeekDay), SortDescriptor(\.classHour), SortDescriptor(\.classMinute)]) private var students: SectionedFetchResults<String, Student>

It sorts my students, consecutively, by their class day, time hour, and time minute. And group them on its weekDay. It works like a charm on my iPhone 14 Pro, and even on an iPhone 7. But when building XCode project, it takes long time, making even coolers fans speed up for a while, like making a great effort until it finally compiles. Only whit three criteria: not with two.

Is this normal? Is this the correct way to do so?

1      

TAKE YOUR SKILLS TO THE NEXT LEVEL If you like Hacking with Swift, you'll love Hacking with Swift+ – it's my premium service where you can learn advanced Swift and SwiftUI, functional programming, algorithms, and more. Plus it comes with stacks of benefits, including monthly live streams, downloadable projects, a 20% discount on all books, and free gifts!

Find out more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.