Skip to content

Instantly share code, notes, and snippets.

@laevandus
Created September 19, 2021 05:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laevandus/2f4dc784f858adb71ee76951876c5a43 to your computer and use it in GitHub Desktop.
Save laevandus/2f4dc784f858adb71ee76951876c5a43 to your computer and use it in GitHub Desktop.
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