// // SwiftUIView.swift // // // Created by Shadowfacts on 12/21/22. // import SwiftUI @available(iOS 16.0, *) struct Separator: View { let axis: Axis @Environment(\.separatorColor) private var separatorColor var body: some View { rect .foregroundColor(separatorColor) .gridCellUnsizedAxes(axis == .vertical ? .vertical : .horizontal) } private var rect: some View { if axis == .vertical { return Rectangle().frame(width: 1) } else { return Rectangle().frame(height: 1) } } } private struct SeparatorColorKey: EnvironmentKey { static var defaultValue = Color.black } extension EnvironmentValues { var separatorColor: Color { get { self[SeparatorColorKey.self] } set { self[SeparatorColorKey.self] = newValue } } }