Created
May 8, 2017 00:23
-
-
Save jen2/3e45eed9eb14ff1f45a572136a85b77b to your computer and use it in GitHub Desktop.
"Securing user data with Keychain for iOS" savePasswordButtonTapped implementation.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import SwiftKeychainWrapper | |
class ViewController: UIViewController { | |
@IBOutlet weak var passwordTextField: UITextField! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
} | |
@IBAction func savePasswordButtonTapped(_ sender: UIButton) { | |
if let password = passwordTextField.text { | |
let saveSuccessful: Bool = KeychainWrapper.standard.set(password, forKey: "userPassword") | |
print("Save was successful: \(saveSuccessful)") | |
self.view.endEditing(true) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment