Last active
August 24, 2020 05:33
-
-
Save olivaresf/e71b0e8b2da673a80283de5994d9b1fe to your computer and use it in GitHub Desktop.
This file contains hidden or 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 SettingViewControllerActionDecider : SettingViewControllerProtocol { | |
| private let PasswordProtectedKey = "front" | |
| var isPasswordProtected: Bool { | |
| get { | |
| guard let front = UserDefaults.standard.object(forKey: PasswordProtectedKey) as? Bool else { return false } | |
| return front | |
| } | |
| set { | |
| UserDefaults.standard.set(newValue, forKey: PasswordProtectedKey) | |
| } | |
| } | |
| func validate(password: String?, confirmPassword: String?, from: SettingViewController) -> Bool { | |
| guard | |
| let givenPassword = password, | |
| let givenConfirmedPassword = confirmPassword else { | |
| print("The password is not equal") | |
| return false | |
| } | |
| return givenPassword == givenConfirmedPassword | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment