โฌ๏ธ ้่ฆ๏ผ 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)
}
}
}