I have a List in SwiftUI App on MacOS with e.g. 10.000 entries.
Trying like the example below is horribly slow.
Adding .id(UUID()) to the List, which was advised in a prior post, makes it a bit quicker but still not fluid.
Even worst, adding .id(UUID()) to the list, the list then cannot be navigates by the arrow-key (up/down).
Is there a better way to achieve this?
struct TestViews_MacOS_BigList: View {
@State var selectedItem: String?
var items: [String]
var body: some View {
List(items,id: \.self, selection: $selectedItem ) { item in
Text("\(item)").tag("\(item)")
}
//.id(UUID())
}
}
func testnames()->[String]{
var list: [String] = []
for i in 1...10000 {
list.append("Sting Nr \(i)")
}
return list
}