I'd like to make the items in my sidebar rearrangeable, like Finder, but when I apply the SidebarListStyle it breaks and causes a crash (tested on Big Sur). By removing the style, reordering works as expected. Is there another modifier I should be using? Thanks!
I opened Feedback FB7520923 to track the issue too.
Code Block swift @main struct MyApp: App { var body: some Scene { WindowGroup { ContentView() } } } struct ContentView: View { @State var strings: [String] = ["A", "B", "C"] @State var selection: String? var body: some View { NavigationView { List(selection: $selection) { ForEach(strings, id: \.self) { string in Text(string) } .onMove { (indexes, dest) in withAnimation { self.strings.move(fromOffsets: indexes, toOffset: dest) } } } .listStyle(SidebarListStyle()) VStack { Spacer() Text(selection ?? "<none>") .frame(idealWidth: 100, maxWidth: .infinity, alignment: .center) Spacer() } } } }
I opened Feedback FB7520923 to track the issue too.