Posts

Post marked as solved
1 Replies
817 Views
Hi, i am very new to developing in SwiftUI. I am not a developer, its my academic background but I didn't follow that path. Even so I love to dev and I will try hard to spend my spare time learning the best I can. I started to follow the ScrimDinger tutorial, I liked it, its basic but its a good intro to the framework and the language. It all went well and when I finished I stated my own project. I ran in to a problem that seems that a lot of ppl also do to run into, but the solution does not fit well into my project. I did a small demo to recreate the problem I am having, here's the code: import SwiftUI struct ColorTestInLists: View {     var myList: [MyRowData] = [ MyRowData(text: "row1", color: Color("yellow")), MyRowData(text: "row2", color: Color.yellow)]         var body: some View {         List{             ForEach(myList){ myrow in                 RowView(text: myrow.text)                     .listRowBackground(myrow.color)             }         }     } } The row 1 doesn't color its background but the row 2 does. This row 2 its the solution I found for the problem with Color("yellow"). The issue is this Color("yellow") it used in the ScrumDinger and somehow it works. Maybe there's a hidden trick to make it happen that they didn't share on the guide explaining. Any tips to make Color(color: String) work in the listRowBackground? Thankyou for sparing your time with my issues :) хай живе україно Zaon
Posted
by Zaon.
Last updated
.