๐Ÿ‘”UpArrowShape

โฌ†๏ธ ้œ€่ฆ๏ผš Vector2D, path.line()

import SwiftUI
import Vector2D        // โญ๏ธ support vector operations

struct UpArrowShape: Shape {
    func path(in rect: CGRect) -> Path {
        Path { p in
            let k: CGFloat = 5           // arrowhead scale
            let A = rect.top + [0, 2]    // arrowhead point
            p.line(A, A + k * [-1, 1])   // ๐Ÿ‘” Vector2D, ๐ŸŒ€ Path+ext
            p.line(A, A + k * [ 1, 1])
            p.line(A, rect.bottom)
        }
    }
}

Last updated