Skip to content

Instantly share code, notes, and snippets.

@laevandus
Created Sep 19, 2021
Embed
What would you like to do?
struct ContentView: View {
@State var items = [1, 2, 3]
var body: some View {
List {
ForEach(items, id: \.self) { item in
Text("\(item)")
}
}
#if os(macOS)
.listStyle(SidebarListStyle())
#else
.listStyle(GroupedListStyle())
#endif
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment