Last active
August 6, 2018 13:45
-
-
Save Otbivnoe/ac4784c2261ae95e8997da146a81feb8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum AppTheme: Int { | |
case light | |
case dark | |
} | |
class SettingsService { | |
var appTheme: AppTheme { | |
get { | |
if let rawValue: AppTheme.RawValue = UserDefaults.standard[#function], let theme = AppTheme(rawValue: rawValue) { | |
return theme | |
} | |
return .light | |
} | |
set { | |
UserDefaults.standard[#function] = newValue.rawValue | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment