I got a preview crash info as this:
*** crashed due to fatalError in PersistentModel.swift at line 559.
This KeyPath does not appear to relate RecordInfo to anything - \RecordInfo.<computed 0x00000001921dfb4e (Array<SomeInfo>)>
If I change preview device to iPhoneSE, It is no crash.
I think the reason is I have some dirty data in iPhone16 Pro preview device.
If I'm right and how to delete it?
Model of RecordInfo like this:
@Model
class RecordInfo {
@Relationship(deleteRule: .cascade) var someInfo:[SomeInfo]
}
@Model
class SomeInfo {
var date: Date
var info: String
}
Post
Replies
Boosts
Views
Activity
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.
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?
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?