Configuring button attributes - Xcode 15, iOS 17

I'm updating my apps to iOS 17 and in Xcode 14 this code worked perfectly. However, Xcode 15 decided it wasn't going to let it work anymore. What I want to accomplish is to set the title of the button to be white and the icon to be blue. In other words, I want to control the color of both items separately. I'd also like to know how to set the disabled color of the button using configurations. I've tried using baseBackgroundColor and baseForegroundColor but it doesn't seem to make any difference. In interface builder, the button is bone stock with no attributes except the title text. (system, plain, plain) I've tried .plain(), .tinted(), .borderless() and commenting the line out but noting gives me what I need.

Any help would be greatly appreciated.

` extension UIButton
 {
    func settingsBtn_Attributes()
    {
        self.configuration = .plain()
        self.configuration?.image = UIImage(systemName: K.Icons.settings, withConfiguration: UIImage.SymbolConfiguration(scale: .large))
        
        self.configuration?.title = K.Tabbar_Names.settings
        self.configuration?.attributedTitle?.foregroundColor = .white
        self.configuration?.imagePlacement = .top
        self.configuration?.titleAlignment = .center
        self.configuration?.imagePadding = 6
        self.configuration?.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0)
        
        self.configuration?.attributedTitle?.font = .systemFont(ofSize: gMenuTextSize, weight: .regular)
    }
 }`

Replies

When you provide a customization such as color or font on your configuration, UIKit presumes that you know what you want and does not modify it further. If you want to modify something like color based on button state, you need to use a configurationUpdateHandler to update the configuration based on the button's state and provide an appropriate color (or font, or other customizations).