SwiftUI List modifiers

How to remove separator between the rows in a List and how to alternate color between adjacent rows?

   List {
          ForEach(sections) { section in
                            Section(section.id) {
                              ForEach(Array(section.enumerated()), id: \.offset) {
                                    HistoryRowView(value: $0.element) .listRowSeparator(.hidden)
                                        .listRowBackground((($0.offset % 2) == 0) ? Color("rowColorLight") : Color("rowColor"))
                                }
                            }
                          
                      }
         }


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *