Skip to content

Instantly share code, notes, and snippets.


fitomad/keychain_add.swift Secret

Created Apr 8, 2019
What would you like to do?
// Lo que vamos a añadir al Keychain...
let query: [String: Any] = [
kSecClass as String: kSecClassGenericPassword,
kSecAttrService as String: self.serviceName,
kSecAttrAccount as String:,
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