Skip to content

Instantly share code, notes, and snippets.

@akultomar17
Last active November 21, 2017 20:29
Show Gist options
  • Save akultomar17/adff54e1231bbd8a3dd266d1b72cfa34 to your computer and use it in GitHub Desktop.
Save akultomar17/adff54e1231bbd8a3dd266d1b72cfa34 to your computer and use it in GitHub Desktop.
fileprivate func saveAccountDetailsToKeychain(account: String, password: String) {
guard account.isEmpty, password.isEmpty else { return }
UserDefaults.standard.set(account, forKey: "lastAccessedUserName")
let passwordItem = KeychainPasswordItem(service: KeychainConfiguration.serviceName, account: account, accessGroup: KeychainConfiguration.accessGroup)
do {
try passwordItem.savePassword(password)
} catch {
print("Error saving password")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment