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

Accepted Reply

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

Replies

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