struct DottedLine: Shape {
func path(in rect: CGRect) -> Path {
var path = Path()
path.move(to: CGPoint(x: 0, y: 0))
path.addLine(to: CGPoint(x: rect.width, y: 0))
return path
}
}
DottedLine()
.stroke(style: StrokeStyle(lineWidth: 1, dash: [2]))
.frame(height: 1)
.foregroundColor(Color.red)
This will create a horizontal dotted line. But how to make it vertical ? If I put Divider() in HStack then it become vertical but how to achieve the same with Dotted line ?