Last active
April 4, 2021 06:24
-
-
Save xmhafiz/a76145351a9432ca4d573b6c58847a5b 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
| // save name and email | |
| let fullName = "John Smith" | |
| CustomUserDefaults.shared.set(fullName, key: .name) | |
| let userEmail = "john@example.com" | |
| CustomUserDefaults.shared.set(userEmail, key: .email) | |
| // print stored name and email | |
| let savedName = CustomUserDefaults.shared.get(key: .name) | |
| print(savedName) // result: Optional(John Smith) | |
| let savedEmail = CustomUserDefaults.shared.get(key: .email) | |
| print(savedEmail) // result: Optional(john@example.com) | |
| let isUserLogin = CustomUserDefaults.shared.get(key: .isUserLogin) | |
| print(isUserLogin) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment