Senior
7
```swift struct CustomButtonStyleView: View { var body: some View { VStack { Button("Button") { print("Tapped") } .buttonStyle(CustomButtonStyle()) } } } private struct CustomButtonStyle: ButtonStyle { func makeBody(configuration: Configuration) -> some View { configuration.label .padding() .foregroundColor(.white) .background(Color.red) .clipShape(RoundedRectangle(cornerRadius: 8)) } } ``` ```swift struct CustomButtonStyleView: View { var body: some View { VStack { Button("Button") { print("Tapped") } .buttonStyle(CustomButtonStyle()) } } } private struct CustomButtonStyle: ButtonStyle { func makeBody(configuration: Configuration) -> some View { configuration.label .padding() .foregroundColor(.white) .frame(maxWidth?) .background(Color.red) .clipShape(RoundedRectangle(cornerRadius: 8)) } } ``` ```swift struct CustomButtonStyleView: View { var body: some View { VStack { Button("Button") { print("Tapped") } .buttonStyle(CustomButtonStyle()) } } } private struct CustomButtonStyle: ButtonStyle { func makeBody(configuration: Configuration) -> some View { configuration.label //.padding() //.foregroundColor(.white) .frame(maxWidth: .infinity) .background(Color.red) //.clipShape(RoundedRectangle(cornerRadius: 8)) } } ``` ```swift struct CustomButtonStyleView: View { var body: some View { VStack { Button("Button") { print("Tapped") } .buttonStyle(CustomButtonStyle()) .frame(width: 200) } } } private struct CustomButtonStyle: ButtonStyle { func makeBody(configuration: Configuration) -> some View { configuration.label //.padding() //.foregroundColor(.white) .frame(maxWidth: .infinity) .background(Color.red) //.clipShape(RoundedRectangle(cornerRadius: 8)) } } ``` The task appears to be about customizing a SwiftUI button style, experimenting with different modifiers such as padding, foreground color, frame width, background color, and clipping shape. The question likely involves fixing or improving the button style to achieve a desired appearance or behavior, such as making the button fill the available width or adjusting its visual style.
Компании, где спрашивали
Salmon