//
|
// 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)
|
}
|
}
|