I create a macOS SwiftUI project, and I want to use Sidebar.
So I saw Paul Hudson's video, he adds .listStyle(SidebarListStyle()) on List.
Here is a screenshot form Paul's video, it works correctly.
I write my own code, set listStyle is SidebarListStyle, but List has scroll indicators (both horizontal and vertical).
This is my code:
import SwiftUI
struct HomeView: View {
private let lists = ["Link 1", "Link 2", "Link 3"]
I found a StackOverflow question [Is there a way to hide scroll indicators in a SwiftUI List?], but the accepted answer reset all UITableView appearance, this is not what I wanted.
So I saw Paul Hudson's video, he adds .listStyle(SidebarListStyle()) on List.
Here is a screenshot form Paul's video, it works correctly.
I write my own code, set listStyle is SidebarListStyle, but List has scroll indicators (both horizontal and vertical).
This is my code:
import SwiftUI
struct HomeView: View {
private let lists = ["Link 1", "Link 2", "Link 3"]
Code Block var body: some View { NavigationView { List { ForEach(lists, id: \.self) { list in NavigationLink(destination: Text("Hello, World!") .frame(maxWidth: .infinity, maxHeight: .infinity)) { Text(list) } } } .listStyle(SidebarListStyle()) .frame(minWidth: 200) } }
}I found a StackOverflow question [Is there a way to hide scroll indicators in a SwiftUI List?], but the accepted answer reset all UITableView appearance, this is not what I wanted.