How to I make a button blue?

Asked on 09/24/2024

1 search

To make a button blue, you can use the tint modifier in SwiftUI to change the color of the button. For example, if you are working with a toggle or a button and want to change its color from the default system blue to a custom blue, you can specify the tint color like this:

Button(action: {
    // Your action here
}) {
    Text("Press Me")
}
.tint(Color.blue)

In the context of the WWDC sessions, the session titled "Extend your app’s controls across the system" discusses customizing control colors, including changing the default system blue tint to a custom color. You can refer to this session for more detailed guidance on customizing controls across the system.