Skip to content

Instantly share code, notes, and snippets.

@abjurato
Last active July 6, 2020 16:18
Show Gist options
  • Save abjurato/bc09d970d329be795c108b396d22d0cf to your computer and use it in GitHub Desktop.
Save abjurato/bc09d970d329be795c108b396d22d0cf to your computer and use it in GitHub Desktop.
extension List {
@ViewBuilder func noSeparators() -> some View {
if #available(iOS 14.0, *) {
self
.accentColor(Color.secondary)
.listStyle(SidebarListStyle())
.onAppear {
UITableView.appearance().backgroundColor = UIColor.systemBackground
}
} else {
self
.listStyle(PlainListStyle())
.onAppear {
UITableView.appearance().separatorStyle = .none
}
}
}
}
@5DQ
Copy link

5DQ commented Jul 6, 2020

extension List {
@ViewBuilder func noSeparators() -> some View {
if #available(iOS 14.0, *) {
self
.accentColor(Color.secondary)
.listStyle(SidebarListStyle())
.onAppear {
UITableView.appearance().backgroundColor = UIColor.systemBackground
}
} else {
self
.listStyle(PlainListStyle())
.onAppear {
UITableView.appearance().separatorStyle = .none
}
}
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment