Runt
2025-06-27 37251af47d1c5e622e8e62a76ff7077f9cd87069
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//
//  IconBack.swift
//  LiveProject
//
//  Created by 倪路朋 on 6/26/25.
//
 
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)
    }
}