Created
June 15, 2018 08:37
-
-
Save onmyway133/d7f5e70c0fd95f7f3eefd3f177d1d2bc 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 to storage | |
try? storage.setObject(10, forKey: "score") | |
try? storage.setObject("Oslo", forKey: "my favorite city", expiry: .never) | |
// Load | |
let score = try? storage.object(ofType: Int.self, forKey: "score") | |
let favoriteCharacter = try? storage.object(ofType: String.self, forKey: "my favorite city") | |
// Check if an object exists | |
let hasFavoriteCharacter = try? storage.existsObject(ofType: String.self, forKey: "my favorite city") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment