With CoreData
I'd like to display adata in the list with Entity as AData and attribute as adata, but I can't find items.adata because the initial value is empty.
says
items.adata?
But it will come out.
What do you need?
struct ContentView:View {
@Environment (.managedObjectContext) private var viewContext
@FetchRequest(
sortDescriptors: NSSortDescriptor (keyPath:\AData.adata, ascending:true),
animation:.default)
private variables —FetchedResults<AData>
varbody:someView {
NavigationView {
List{
Section {
ForEach(0..<items.adata.count) {Text(items.adata[index])})
}
} header: {
Text ("dust")
}
}
}
I don't have a confirmation environment at hand, so I imagine it.
ForEach(0..<items.count) {index in Text(items[index].adata)}
I think it will be
© 2024 OneMinuteCode. All rights reserved.