remove divider list swiftui
init() {
UITableView.appearance().separatorColor = .clear
}
var body: some View {
List {
...
}
}
remove divider list swiftui
init() {
UITableView.appearance().separatorColor = .clear
}
var body: some View {
List {
...
}
}
swiftui remove list dividers
// while this solution works correctly let's clean up the work using ViewModifier
public struct ListSeparatorStyleNoneModifier: ViewModifier {
public func body(content: Content) -> some View {
content.onAppear {
UITableView.appearance().separatorStyle = .none
}.onDisappear {
UITableView.appearance().separatorStyle = .singleLine
}
}
}
// now let's make a small extension that would help to hide the details
extension View {
public func listSeparatorStyleNone() -> some View {
modifier(ListSeparatorStyleNoneModifier())
}
}
// As you can see, we’ve wrapped our appearance setting code into a neat little view modifier. you can declare it directly now
List {
Text("1")
Text("2")
Text("3")
}.listSeparatorStyleNone()
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us