Mac Catalyst UIButton configuration when window is not active

Hi,

I'm trying to define the style of an UIButton using UIButton.Configuration in a Mac Catalyst app.

I was able to configure the component as I want except one thing. I want to change the style of the button when the window is not active.

The default filled style automatically do this. For example below you can see a button configured with UIButton.Configuration.filled().

If the window become inactive (for example by activating another application) the color of the button change, like so:

Now, If I configure a button with this configuration:

var configuration = UIButton.Configuration.plain()
configuration.background.strokeColor = .gray
configuration.baseForegroundColor = .red
configuration.baseBackgroundColor = .clear

the button display with this configuration when the window is active:

but also when it's not active:

I want to change the text color from red to gray when the window is not active. Someone know how to do it?

Thank you

Mac Catalyst UIButton configuration when window is not active
 
 
Q