Skip to content

Commit 5069fc4

Browse files
committed
Implement Divider view
1 parent 66a6df7 commit 5069fc4

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/// A divider that expands along the minor axis of the containing stack layout
2+
/// (or horizontally otherwise). In dark mode it's white with 10% opacity, and
3+
/// in light mode it's black with 10% opacity.
4+
public struct Divider: View {
5+
@Environment(\.colorScheme) var colorScheme
6+
7+
var color: Color {
8+
switch colorScheme {
9+
case .dark:
10+
Color(1, 1, 1, 0.1)
11+
case .light:
12+
Color(0, 0, 0, 0.1)
13+
}
14+
}
15+
16+
public init() {}
17+
18+
public var body: some View {
19+
color.frame(height: 1)
20+
}
21+
}

0 commit comments

Comments
 (0)