Created
March 16, 2018 06:32
-
-
Save Otbivnoe/1dbbecd262af4939e748959e1efa7667 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
class SettingsService { | |
private enum Keys { | |
static let isNotificationsEnabled = "isNotificationsEnabled" | |
} | |
var isNotificationsEnabled: Bool { | |
get { | |
let isEnabled = UserDefaults.standard.value(forKey: Keys.isNotificationsEnabled) as? Bool | |
return isEnabled ?? true | |
} | |
set { | |
UserDefaults.standard.setValue(newValue, forKey: Keys.isNotificationsEnabled) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment