-
-
Save jedmund/63082a2d15e69fff7519180019348d14 to your computer and use it in GitHub Desktop.
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
source 'https://github.com/CocoaPods/Specs.git' | |
platform :ios, "10.0" | |
use_frameworks! | |
target 'Locksmith-test' do | |
pod 'Locksmith', | |
:git => 'https://github.com/pascalfribi/Locksmith.git', | |
:branch => 'swift-3.0' | |
end |
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
Locksmith: Saving data to keychain... | |
Locksmith: Receiving data from keychain... | |
Locksmith: Data received from keychain: nil |
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 Locksmith | |
class ViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view, typically from a nib. | |
let data: [String: Any] = ["username": "myUsername"] | |
let account: String = "myUserAccount" | |
let service: String = "myService" | |
do { | |
print("Locksmith: Saving data to keychain...") | |
try Locksmith.saveData(data: data, forUserAccount: account, inService: service) | |
print("Locksmith: Receiving data from keychain...") | |
let result = Locksmith.loadDataForUserAccount(userAccount: account, inService: service) | |
print("Locksmith: Data received from keychain: \(result)") | |
} catch let error { | |
print("Locksmith: Error! \(error.localizedDescription)") | |
} | |
} | |
override func didReceiveMemoryWarning() { | |
super.didReceiveMemoryWarning() | |
// Dispose of any resources that can be recreated. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment