Last active
July 6, 2020 16:18
-
-
Save abjurato/bc09d970d329be795c108b396d22d0cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
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
}
}
}
}