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
Label cannot export localized string key
Hello all. This is my code snippet. RecordListView() .tabItem { Label("Record List", systemImage: "list.clipboard") } .tag(Tab.RecordList) When I export localizations, there is no Record List in the .xcloc file. Then I use LocalizedStringKey for Label and export localizations file, the code is as follows: let RecordsString:LocalizedStringKey = "Tab.Records" RecordListView() .tabItem { Label(RecordsString, systemImage: "list.clipboard") } .tag(Tab.RecordList) There is still no Tab.Records.
0
0
1
1m