Skip to content

Instantly share code, notes, and snippets.

@philipshen
Last active August 20, 2019 02:26
Show Gist options
  • Save philipshen/a8063d5edb6925c2344563926e1c7d72 to your computer and use it in GitHub Desktop.
Save philipshen/a8063d5edb6925c2344563926e1c7d72 to your computer and use it in GitHub Desktop.
Keychain Examples
let query: [String:Any] = [
kSecClass as String: kSecClassGenericPassword,
kSecAttrSynchronizable as String: kCFBooleanTrue,
kSecAttrAccount as String: "accountName".data(using: .utf8)!,
kSecValueData as String: "data to store".data(using: .utf8)!,
]
let status: OSStatus = SecItemAdd(addQuery as CFDictionary, nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment