Problem and Try
struct PlayGroundThirdView: View {
//some variables
//some vm and controller
var body: some View {
//some views
Button {
vcontroller.fetch()
vcontroller.setColor(.red)
} label: {
Text("Refresh")
}
.frame(width: 50, height: 50, alignment: .leading)
.foregroundColor(.white)
.background(.red)
.cornerRadius(20)
}
}
I want corner radius of button only apply to TWO corners Only for leading direction but has never work with clipshape or even alignment leading.
CodePudding user response:
Can be achieved with working with just padding()
for this case.
HStack {
Spacer()
Button("Refresh") {
...
}
.padding(10)
.foregroundColor(.white)
.background(.red)
.padding(.trailing, 20) //corner radius part
.cornerRadius(20) //corner radius part
.padding(.trailing, -20) //corner radius part
}