🖼️GridLines
SwiftUI ⟩ Drawing ⟩ Shape ⟩ Helper Shapes ⟩

⬆️ 需要: GridLinesShape
// 2022.02.10
import SwiftUI
/// vertical & horizontal grid lines in a rect.
/// ```
/// GridLines()
/// GridLines(rows: 5, cols: 5)
/// GridLines(color: .gray, border: .pink)
/// ```
struct GridLines: View {
var rows: Int = 10
var cols: Int = 10
var color: Color = .secondary.opacity(0.5) // grid line color
var border: Color = .primary.opacity(0.8) // border color
var body: some View {
GridLinesShape(rows: rows, cols: cols) // 💜 GridLinesShape
.stroke(color)
.border(border)
}
}
Last updated
Was this helpful?