Reputation: 1216
I'm wondering how to change the default system background color given to iOS apps. For example, when you create a blank XCode project, the canvas is, by default, white. Is there a way to change this default color, without creating a separate background view?
Upvotes: 1
Views: 4747
Reputation: 154
You cannot modify it directly systemBackground
because it is declared as a read-only class property. But it is declared as open
though, so you can do something like:
class MyColor: UIColor {
override class var systemBackground: UIColor {
return .systemRed
}
}
And use it like MyColor.systemBackground
.
I find this approach unnecessary though, I would just recommend creating your own utility/helper class to define your own color palette and avoid inheriting from UIColor.
Upvotes: 1