I'm trying to use UIAppearance to create a theme for my app.
Say I want all my UILabel
's texts to be orange. I wrote:
UILabel.appearance(whenContainedInInstancesOf: [UIView.self]).textColor = .orange
But I realized that:
- This worked for every
UILabel
created via Interface Builder. - This does not work for any
UILabel
created programmatically. They are displayed in black by default
Any idea how I can force programmatically created instances to be orange as well?
PS: I've also tried: UILabel.appearance().textColor = .green
which is not what I want but it doesn't work either.