Skip to content

Instantly share code, notes, and snippets.

@justin
Created September 15, 2014 18:32
Show Gist options
  • Save justin/f8c0a153aa7d7c9595ee to your computer and use it in GitHub Desktop.
Save justin/f8c0a153aa7d7c9595ee to your computer and use it in GitHub Desktop.
import KeychainAPI
let keychain: Keychain = Keychain(service: "com.secondgear.myapp", accessibility: Accessibility.WhenUnlocked)
let userAccount = Account(userName: "justinw@me.com", secret: "lovesecretsexgod")
keychain.add(userAccount)
let fetchedAccount:Account? = keychain.accountFor("justinw@me.com")
if (fetchedAccount != nil)
{
fetchedAccount?.secret = "newpassword"
keychain.update(fetchedAccount!)
}
keychain.remove(fetchedAccount!);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment