I would like the code that I am writing to have the user be able to call the UserDefaults that sets the background color throughout all UIViewController. So user hits pressButton and throughout all of the view controllers the background color will always be brown. So instead of having to segue variables for settings the settings are automatically updated through a call to the extension file.
Hi @timswift,
So are you after the code to use UserDefaults or setting the backgroundColor to a set color as saved in UserDefaults?
How about creating an extension function called defaultBackgroundColor that returns the color from UserDefaults or White if this is not set and then set it to the view in every viewDidLoad() function.
However the fun part is that you cannot save UIColor directly to UserDefaults, so you will need to use NSKeyedArchiver and NSKeyedUnarchiver