I want all the lists in my application to look exactly the same and don't want to respecify all these settings over and over. I get the following error: Cannot find type 'Configuration' in scope. I currently have something like this:
struct CustomListStyle: ListStyle { func makeBody(configuration: Configuration) -> some View { ScrollView { VStack(spacing: 10) { ForEach(configuration.data, id: \.self) { item in Text(item as? String ?? "") .foregroundColor(.blue) .padding(10) .background(Color.gray) .cornerRadius(10) } } .padding() } }}struct ContentView: View { var body: some View { List(0..<10, id: \.self) { index in Text("Item \(index)") } .listStyle(CustomListStyle()) }}
Edit - 1 - Here is one for reference
List( selection: $dm.someVar ) { Section( ) { LazyVGrid(columns: [ GridItem(.flexible(minimum: 120)), ], alignment: .leading, spacing: 10) { ForEach(0..<20, id: \.self) { index in Text("Column1 abcdef: \(index)") } } }}