Looking at the brand new WWDC video Implementing Dark Mode on iOS we see that it can be handled quite easily. We can use the new dynamic system colors and they will have specific values depending on Light or Dark Mode.
Now, how can this new concept be combined with the need to implement more than two themes – in a clean and future-proof way?
I have have researched and applied different theming approaches in the past like the UIAppearance approach (e.g. Ray Wenderlich´s UIAppearance Tutorial) or a protocol-based custom dynamic colors approach.
Is the following code an appropriate position to start by finding out when the system requires a switch from light to dark mode and vice versa? And then by changing app wide colors in any of the possible "old" ways?
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
if traitCollection.hasDifferentColorAppearance(comparedTo: previousTraitCollection) {
/// Really have to go from here?
}
}