Skip to content

Instantly share code, notes, and snippets.

@artemnovichkov
Created December 16, 2019 04:14
Show Gist options
  • Save artemnovichkov/52c2a0309ae04bb9d0b135ec0ba2e19e to your computer and use it in GitHub Desktop.
Save artemnovichkov/52c2a0309ae04bb9d0b135ec0ba2e19e to your computer and use it in GitHub Desktop.
Updating layer colors with new trait collection
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
traitCollection.hasDifferentColorAppearance(comparedTo: traitCollection) {
layer.backgroundColor = UIColor.layer.cgColor
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment