Last active
June 10, 2021 07:58
-
-
Save rinsuki/be3260bd1317f46409222f347b70e877 to your computer and use it in GitHub Desktop.
I finally understand how to `tableView.separatorInset = .zero` in SwiftUI List (iOS 15+)
This file contains hidden or 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
import SwiftUI | |
import Introspect // from SwiftPM https://github.com/siteline/SwiftUI-Introspect | |
struct ContentView: View { | |
var body: some View { | |
List { | |
Text("some") | |
.listRowSeparator(.hidden) // disable SwiftUI.List separator | |
Text("thing") | |
.listRowSeparator(.hidden) // disable SwiftUI.List separator | |
Text("some") | |
.listRowSeparator(.hidden) // disable SwiftUI.List separator | |
Text("thing") | |
.listRowSeparator(.hidden) // disable SwiftUI.List separator | |
} | |
.listStyle(.plain) | |
.introspectTableView { tableView in // enable UITableView separator 🙃 | |
tableView.separatorStyle = .singleLine | |
tableView.separatorInset = .zero | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment