我试着填充包含的strokeBorder,但不幸的是它填充了矩形。如下图所示:
有什么办法可以让它仅填充到 strokeborder?我想将该字段用作搜索框,这就是为什么我想在其中使用textfield的原因。
以下是我的代码:
struct ContentView: View {
var body: some View {
HStack{
TextField("Search", text: .constant(""))
}
.padding()
.frame(maxWidth:300)
.background(
Capsule()
.strokeBorder(Color.black,lineWidth: 0.8)
.background(Color.blue)
.clipped()
)
}
}
非常感谢!