Skip to content

Instantly share code, notes, and snippets.

@fitomad
Created April 8, 2019 18:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fitomad/4a38517e25dd838b172d618d6b711cc0 to your computer and use it in GitHub Desktop.
Save fitomad/4a38517e25dd838b172d618d6b711cc0 to your computer and use it in GitHub Desktop.
// Lo que vamos a añadir al Keychain...
let query: [String: Any] = [
kSecClass as String: kSecClassGenericPassword,
kSecAttrService as String: self.serviceName,
kSecAttrAccount as String: user.name,
kSecValueData as String: passwordData
]
// Operación
let status = SecItemAdd(query as CFDictionary, nil)
// Comprobamos el resultado
if status != errSecSuccess
{
throw KeychainError.unknown(status: status)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment