I want to achieve a path like this in the picture using Path in SwiftUI, but my understanding of the Bezier curve is minimal, and I cannot reproduce the drawing on the image.
I am talking about the background drawing, which is hard to notice; it's like a mountain or staircase.
Any help will be appreciated!
Image to reproduce:
Here is my code:
struct BezierCurveView: Shape {
func path(in rect: CGRect) -> Path {
var path = Path()
path.move(to: CGPoint.zero)
path.addCurve(to: CGPoint(x: rect.maxX / 3, y: rect.minY), control1: CGPoint(x: rect.minX + 40, y: rect.minY - 90), control2: CGPoint(x: rect.minX + 80, y: rect.minY - 90))
path.addLine(to: CGPoint(x: rect.maxX, y: rect.minY))
path.addLine(to: CGPoint(x: rect.maxX, y: rect.maxY))
path.addLine(to: CGPoint(x: rect.minX, y: rect.maxY))
return path
}
}
Here is the result of my code: