我正在尝试使用 swift 绘制形状,这是我的代码
struct ElementView: View {
var element: Element
var body: some View {
let rec = RoundedRectangle(cornerRadius: 25.0)
return ZStack {
rec
.frame(width: 300, height: 150, alignment: .center)
.foregroundColor(.pink)
.opacity(0.4)
.overlay(
rec.stroke(
Color.pink,
style: StrokeStyle(
lineWidth: 5,
lineCap: .round,
lineJoin: .round
)
)
)
Text("Text")
}
}
}
Run Code Online (Sandbox Code Playgroud)
只有一个边框,但我想要两个或更多
我的结果: https: //i.stack.imgur.com/n26Vb.png
预期内容: https: //i.stack.imgur.com/L23cW.png
如何添加多个边框?