How do I make a UIButton with AttributedString glass with a tinted color?

Asked on 2026-03-16

1 search

To create a UIButton with an AttributedString and apply a glass effect with a tinted color, you can follow these steps based on the information from the WWDC sessions:

  1. Use Liquid Glass: Utilize the new Liquid Glass appearance for buttons. You can use the UIButtonConfiguration to apply a glass effect. There are two configurations available: standard glass and prominent glass, which is tinted with your app's tint color.

  2. Apply Tint Color: Set the tint color for the button to emphasize it as a primary element in your UI. This can be done by setting the button's tint color property.

  3. AttributedString for Text: Use AttributedString to customize the text appearance on the button. You can set attributes like font, color, and more to style the text.

Here's a basic example of how you might set this up in code:

let button = UIButton(type: .system)
var configuration = UIButton.Configuration.glass()
configuration.title = "Your Button Title"
configuration.attributedTitle = AttributedString("Your Button Title", attributes: [.foregroundColor: UIColor.systemOrange])
button.configuration = configuration
button.tintColor = UIColor.systemOrange

For more detailed guidance on using Liquid Glass and configuring buttons, you can refer to the session Build a UIKit app with the new design (17:24).