Post

Replies

Boosts

Views

Activity

[SwiftData] How to use @Query to get the first 7 elements in the list
Maybe I didn't find the relevant instructions. In my code, I only want to get the first 7 elements. At present, my code is as follows: @Query(sort:\Record.date, order: .reverse) private var records:[Record] But I wonder if once the number of records is large, will it affect the efficiency? In View, it is enough for me to count the first 7 elements in records. What should I do?
1
0
132
1w