In SwiftUI List Appears to have a property called ListStyle.
How can i change the style of the list
struct ListView : View {
var body: some View {
NavigationView {
List(Item.create().identified(by: \.id)){ row in
NavigationButton(destination: DetailsView(item: row)) {
RowView(item: row)
}
}
.listStyle(StaticMember<PlainListStyle.Member>.self) // error here
.foregroundColor(.red)
.navigationBarTitle(Text("List View"))
.statusBar(hidden: false)
}
}
}
The conforming parties of ListStyle protocol are
- CarouselListStyle
- DefaultListStyle
- GroupedListStyle
- PlainListStyle
- SidebarListStyle
However i am struggling trying to set a new style for the list using it like this
.listStyle(StaticMember<PlainListStyle.Member>.self)
I have tried so many ways, but each style confirming to the ListStyle is struct, like they're not enumerated values
Anyone have an idea how to change the style of List ?
Error in Xcode
Cannot convert value of type 'StaticMember.Type' (aka 'StaticMember>.Type') to expected argument type 'StaticMember<_>'
Using : .listStyle(StaticMember<PlainListStyle.Member>)
Error in Xcode
Cannot convert value of type '(StaticMember).Type' (aka 'StaticMember>.Type') to expected argument type 'StaticMember<_>'
Using : .listStyle(StaticMember<PlainListStyle()>) or .listStyle(StaticMember<PlainListStyle.self>)
Error in Xcode
'>' is not a postfix unary operator