swiftui shape style code example
Example: swiftui drawing custom shapes
struct Arrow: Shape {
func path(in rect: CGRect) -> Path {
Path { path in
let width = rect.width
let height = rect.height
path.addLines( [
CGPoint(x: width * 0.4, y: height),
CGPoint(x: width * 0.4, y: height * 0.4),
CGPoint(x: width * 0.2, y: height * 0.4),
CGPoint(x: width * 0.5, y: height * 0.1),
CGPoint(x: width * 0.8, y: height * 0.4),
CGPoint(x: width * 0.6, y: height * 0.4),
CGPoint(x: width * 0.6, y: height)
])
path.closeSubpath()
}
}
}