How do I make a UIButton with AttributedString a glass tint?

Asked on 2026-03-16

1 search

To create a UIButton with an AttributedString and apply a glass tint effect, you can use the new design features introduced in iOS 26. Specifically, you can use the UIButtonConfiguration to apply a glass appearance to your button. Here's a general approach based on the sessions from WWDC 2025:

  1. Create a UIButton with AttributedString: Use AttributedString to style the text of your button. You can set attributes like font, color, and more.

  2. Apply Glass Tint: Use the UIButtonConfiguration to apply a glass appearance. You can choose between standard glass and prominent glass, which tints the button with your app's tint color.

Here's a basic example in code:

import UIKit

let button = UIButton(type: .system)
var configuration = UIButton.Configuration.plain()
configuration.attributedTitle = AttributedString("Your Button Title", attributes: [.foregroundColor: UIColor.systemOrange])
configuration.baseBackgroundColor = .clear // Ensure the background is clear to see the glass effect
configuration.background = .glass // Apply the glass effect

button.configuration = configuration

For more detailed guidance, you can refer to the session Build a UIKit app with the new design (17:24) where they discuss controls and the use of glass appearances in UIKit.