I am trying to create SideBarList in SwiftUI using List, but I am not getting desired look.
When I build my code, the Sidebar list keeps showing the scrollbar place even there is no scroll bar and no need for that.
Code:
Using:
macOS: 10.15.6
Xcode: 12.0
Swift: 5.3
When I build my code, the Sidebar list keeps showing the scrollbar place even there is no scroll bar and no need for that.
Code:
Code Block import SwiftUI struct DetailView: View { let text: String var body: some View { Text(text) .frame(maxWidth: .infinity, maxHeight: .infinity) } } struct ContentView: View { private let names = ["Homer", "Marge", "Bart", "Lisa"] @State private var selection: String? var body: some View { NavigationView { List(selection: $selection) { Section(header: Text("The Simpsons")) { ForEach(names, id: \.self) { name in NavigationLink(destination: DetailView(text: name)) { Text(name) } } } }.listStyle(SidebarListStyle()) DetailView(text: "Make a selection") } } }
Using:
macOS: 10.15.6
Xcode: 12.0
Swift: 5.3