Skip to content

Instantly share code, notes, and snippets.

@artemnovichkov
Last active December 25, 2022 12:30
Show Gist options
  • Save artemnovichkov/659a520570d2d276e7140947f77d6c41 to your computer and use it in GitHub Desktop.
Save artemnovichkov/659a520570d2d276e7140947f77d6c41 to your computer and use it in GitHub Desktop.
Saving UIUserInterfaceStyle to UserDefaults
public extension UserDefaults {
var overridedUserInterfaceStyle: UIUserInterfaceStyle {
get {
UIUserInterfaceStyle(rawValue: integer(forKey: #function)) ?? .unspecified
}
set {
set(newValue.rawValue, forKey: #function)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment