Using UIButton's appearance() class method for the disabled control state

Hey everyone,
Is it possible to edit a buttons UI via the appearance proxy object for a chosen UIControlState? I’m implementing multiple themes for my app and I’d like to change the backgroundColor and tintColor properties for all the buttons in the app for their disabled state and I struggle to find a way to do that.
Thanks in advance for any help.

@muclbahaloute Thanks very much for your question!

One approach that stands out is to simply create a subclass of UIButton via extensions, and then provide functions that would allow you to send properties that would allow you to customize the buttons throughout your app. What you want to do here, is ensure there is a clear separation of variables that can be modified so that any changes you make will take effect universally in your app. Thus, there should be a single place where these changes would take place.

So in your case, clicking on a button could trigger a method which takes a value from the button that is calling it (which can be uniquely identified by assigning a tag value to the button), and depending on what this tag value is, any number of events can then be called. What this event is, is entirely up to you, but with a carefully thought out approach, you should be able to come up with a decent solution. :slight_smile:

I hope this helps!

All the best!