SwiftUI hierarchical Picker with dynamic data crashes [duplicate]
问题 This question already has an answer here : swiftUi : 2 Pickers on one screen - app crash with “Index out of range” (1 answer) Closed last month . I just started working on SwiftUI and I have some difficulty to manage several Pickers with dynamic data. In that case there's two Pickers, for Country and City . When I try to switch the Picker from a country with more cities than the other, the app would crash : Fatal error: Index out of range Any idea how I could fix that ? App Screenshot import