-
-
Save sturdysturge/0179575a64e8fcafcd5d5f8474693adb 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
import SwiftUI | |
@available(iOS 16.0, *) | |
struct ContentView: View { | |
var body: some View { | |
VStack { | |
List { | |
Section("Separators") { | |
ForEach(0..<10) { index in | |
Text("\(index) Separate") | |
} | |
// Implicit .listRowSeparator(.automatic) is | |
// .listRowSeparator(.visible) on iOS | |
} | |
Section("No Separators") { | |
ForEach(0..<10) { index in | |
Text("\(index) Not Separate") | |
} | |
.listRowSeparator(.hidden) | |
} | |
Section("Every Other Separator") { | |
ForEach(0..<10) { index in | |
let indexIsEven = index % 2 == 0 | |
Text("\(index) \(indexIsEven ? "Hidden" : "Visible")") | |
.listRowSeparator(indexIsEven ? .hidden : .visible) | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment