Runt
2025-06-27 e21b1c797955a231f2bcf71818e0259fbb6aeba1
LiveProject/shape/IconBack.swift
@@ -5,4 +5,32 @@
//  Created by 倪路朋 on 6/26/25.
//
import Foundation
import SwiftUI
struct IconBack: Shape {
    func path(in rect: CGRect) -> Path {
        var path = Path()
        let arrowHeadLength = rect.width * 0.4
        let shaftY = rect.midY
        let headHeight = rect.height * 0.5
        // 箭头头部(三角形)
        path.move(to: CGPoint(x: arrowHeadLength, y: rect.minY))
        path.addLine(to: CGPoint(x: 0, y: shaftY))
        path.addLine(to: CGPoint(x: arrowHeadLength, y: rect.maxY))
        // 箭身(横线)
        path.move(to: CGPoint(x: 0, y: shaftY))
        path.addLine(to: CGPoint(x: rect.maxX, y: shaftY))
        return path
    }
}
struct IconBack_Previews : PreviewProvider{
    static var previews: some View {
        IconBack()
            .stroke(Color.primary, lineWidth: 3).frame(width: 30,height: 25)
    }
}