Draw arrows in swiftUI

Viewed 208

I'm trying to draw an arrow like the one below but haven't finished it yet. Hope you can help me

My code

struct ContentView: View {

    @State private var change = false
    
    private let arrowWidth: CGFloat = 128
    
    var body: some View {
        Path { path in
            path.move(to: .zero)
            path.addLine(to: CGPoint(x: arrowWidth/2, y: -20))
            path.move(to: CGPoint(x: arrowWidth/2, y:  -20))
            path.addLine(to: CGPoint(x: arrowWidth, y: 0))
        }
        .stroke(style: StrokeStyle(lineWidth: 1, lineCap: .round))
        .frame(width: arrowWidth)
        .foregroundColor(.green)
        .animation(.default)
        .padding(.top, 300)
    }
}
1 Answers

enter image description here

Follow this images to create your path, then fill it

Related