public var body: some View {
List {
...
}
.listStyle(isPhone ? .plain : .sidebar)
}
When I write code like above, I get a compile error: "Member 'sidebar' in 'PlainListStyle' produces result of type 'SidebarListStyle', but context expects 'PlainListStyle'"
It looks like the root cause is:
Protocol 'ListStyle' can only be used as a generic constraint because it has Self or associated type requirements
How can I solve this problem?
Thanks,