我能够回答我自己的问题,使用自定义路径并将其附加到标签栏。
struct Arc: Shape {
var height: CGFloat = 20
var length: CGFloat = 80
var startX: CGFloat = 0
func path(in rect: CGRect) -> Path {
var path = Path()
let midPoint: CGFloat = (startX + length) / 2
let apex1: CGFloat = (startX + midPoint) / 2
let apex2: CGFloat = (midPoint + length) / 2
path.move(to: CGPoint(x: startX, y: height))
path.addCurve(to: CGPoint(x: midPoint, y: 0), control1: CGPoint(x: apex1, y:
height), control2: CGPoint(x: apex1, y: 0))
path.addCurve(to: CGPoint(x: length, y: height), control1: CGPoint(x: apex2, y: 0), control2: CGPoint(x: apex2, y: height))
return path
}
}