I've come across some puzzling behaviour of the SwiftUI List view. The List view is called with a binding that already contains some selected items. I know they exist. My data is longer than what can be shown on the screen. All the selected items on the part that is visible already are displayed as expected but when I scroll down the list to look for the other ones, they do not show straight away. I have to wait several minutes before they show.
Here is the code that generates the List:
import SwiftUI
struct ArtistView: View {
@State private var editMode = EditMode.active
@Binding var selection : Set<String>
var artists = [String]()
var body: some View {
List(selection: self.$selection) {
ForEach (self.artists, id: \.self) {artist in
Text(artist)
}
}
.environment(\.editMode, self.$editMode)
}
}
Here is the code that calls the ArtistView:
NavigationLink(destination: ArtistView(selection: self.$selection, artists: self.settings.artists)) {
Text("Select Artists:")
}
Has anyone seen this kind of behaviour and more importantly is there a way to speed this display issue up?
Thanks