Skip to content

Instantly share code, notes, and snippets.

@akultomar17
Created November 11, 2017 14:28
Show Gist options
  • Save akultomar17/c73622dac3aae9fcfd4eba54ad8eae4d to your computer and use it in GitHub Desktop.
Save akultomar17/c73622dac3aae9fcfd4eba54ad8eae4d to your computer and use it in GitHub Desktop.
fileprivate func loadPasswordFromKeychainAndAuthenticateUser(_ account: String) {
guard !account.isEmpty else { return }
let passwordItem = KeychainPasswordItem(service: KeychainConfiguration.serviceName, account: account, accessGroup: KeychainConfiguration.accessGroup)
do {
let storedPassword = try passwordItem.readPassword()
authenticateUser(storedPassword)
} catch KeychainPasswordItem.KeychainError.noPassword {
print("No saved password")
} catch {
print("Unhandled error")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment