If I put code in my AppDelegate's DidFinishLaunchingWithOptions function, I am easily able to change the Tab Bar's color, but if I call a function with the same code in a ViewController, then it does not change. How can I get it to change after pressing a button in a view controller for example?
Here is the code in the DidFinishLaunchingWithOptions function:
UITabBar.appearance().tintColor = UIColor.white
UITabBar.appearance().barTintColor = UIColor.black
Using the appearance
proxy sets the attributes for any new control created afterwards. It doesn't change any existing related control.
If you wish to set the attributes of a specific, existing instance, set the attributes directly on the control without using the appearance
proxy.
someTabBar.tintColor = UIColor.purple
someTabBar.barTintColor = UIColor.orange