Posts

Post not yet marked as solved
1 Replies
1.6k Views
Hi,I want to create diffrent cell with seperate color in a section. Reagards,Ranjeetstruct AlternateListCellView: View { var body: some View { List { Section(header: Text("Show alternate cell")) { ForEach(1...5) { row in Text("Row Index = \(row)") } // "row" variable is out of scope, so its throw compile time error. Is any other way to create section and cell? // Kindly correct me if Any mistake. // .listRowBackground(row % 2 == 0 ? Color.orange : Color.yellow) } } .background(Color.purple) } }
Posted Last updated
.
Post not yet marked as solved
3 Replies
6.5k Views
Hi,My requrement is to set background view as image to the List view in SwiftUI.Could any one help me achive it?Regards,Ranjeetstruct TableView_SwiftUI: View { var body: some View { List(1...5) { row in Text("Row Index \(row)") }.background(Image("bg")) } }
Posted Last updated
.