Our theming is quickly becoming messy as we have fonts, colors, and images scattered throughout the app. This becomes especially ugly when introducing things like https://github.com/mozilla/firefox-ios/pull/97. We should consider creating a themes class to contain these resources. One approach is loosely outlined on Stack Overflow: http://stackoverflow.com/questions/13547860/best-practices-of-theming-skinning-an-ios-app
Hey Brian, I haven't contributed to the project but have been following from afar and I might be able to make a suggestion. One thing I've done in the past is wrap any stylings on fonts/images/etc inside their own extensions on the framework classes that describe how the font is used - like extension methods named tabHeader, detailText, etc. The extension method can then delegate/proxy to a theme controller that has knowledge of the various themes available to the app. These themes can be stored in a plist file or some other format and be parsed into the controller. At runtime, when the user toggles different modes, the theme controller updates it's current theme and the associated proxied extension methods have the new theme. Another benefit of this approach is that it cleans up a lot of styling you need to do on your views in your view controllers and keeps the code DRY but not repeating the same fonts/colors/etc across the app. I haven't done this in Swift yet - only in ObjC - but I can't imagine it being that much different. Hope that helps a bit!
(In reply to Brian Nicholson (:bnicholson) from comment #0) > We should consider creating a themes class to contain these resources. One > approach is loosely outlined on Stack Overflow: > http://stackoverflow.com/questions/13547860/best-practices-of-theming- > skinning-an-ios-app Note that those answers are from before Apple introduced extensive theming support in UIKit. We should take advantage of that where possible I think. Check out http://nshipster.com/uiappearance/ for a quick intro to UIAppearance
I did something like this in bug 1148469. We need to pull out more, but I've been waiting to see what's duplicated to figure out what to pull out... Closing this though.