I have a view where the user can configure which train lines are shown on a map. I'm having an issue where the list row background is ignored for all of the cells which are selected.
Here is code that I am using:
Here is code that I am using:
Code Block swift struct MapConfigurator: View { @Binding var routes: Set<Route> var body: some View { List(selection: $routes) { Section(header: Text("Show")) { ForEach(Route.allCases, id: \.self) { route in Text(route.name) .foregroundColor(route.textColor) .listRowBackground(route.color) .tag(route) } } } .navigationBarTitle("Configure Map") .listStyle(GroupedListStyle()) .environment(\.editMode, .constant(.active)) } } struct MapConfigurator_Previews: PreviewProvider { static var previews: some View { NavigationView { MapConfigurator(routes: .constant([.red, .green, .blue])) } } }