SwiftData .returnsDistinctResults ?

With NSFetchRequest of coreData it was possible to only return distinct results from the database with .returnsDistinctResults

What if any is the fetch equivalent in SwiftData ?

currently I'm appending entries into a Set<String>. Only with over 200k rows and no newBackgroundContext() in SwiftData the UI is locked for a number of seconds

Answered by RyanTCB in 770109022

I have found installing the swift algorithms package gives a .uniqued(on: \.keyPath) method that can be applied to an array.

Accepted Answer

I have found installing the swift algorithms package gives a .uniqued(on: \.keyPath) method that can be applied to an array.

SwiftData .returnsDistinctResults ?
 
 
Q