|
|
@@ -13,6 +13,8 @@ class ViewController: UIViewController {
|
|
|
|
|
|
let keychain = KeychainSwift()
|
|
|
|
|
|
+ static let accessGroup = "synch keychain group"
|
|
|
+
|
|
|
override func viewDidLoad() {
|
|
|
super.viewDidLoad()
|
|
|
|
|
|
@@ -27,6 +29,8 @@ class ViewController: UIViewController {
|
|
|
@IBAction func onSaveTapped(sender: AnyObject) {
|
|
|
if let text = textField.text {
|
|
|
keychain.synchronizable = synchronizableSwitch.on
|
|
|
+// keychain.accessGroup = synchronizableSwitch.on ? ViewController.accessGroup : nil
|
|
|
+
|
|
|
keychain.set(text, forKey: TegKeychainDemo_keyName)
|
|
|
updateValueLabel()
|
|
|
}
|
|
|
@@ -34,6 +38,8 @@ class ViewController: UIViewController {
|
|
|
|
|
|
@IBAction func onDeleteTapped(sender: AnyObject) {
|
|
|
keychain.synchronizable = synchronizableSwitch.on
|
|
|
+// keychain.accessGroup = synchronizableSwitch.on ? ViewController.accessGroup : nil
|
|
|
+
|
|
|
keychain.delete(TegKeychainDemo_keyName)
|
|
|
updateValueLabel()
|
|
|
}
|
|
|
@@ -44,6 +50,7 @@ class ViewController: UIViewController {
|
|
|
|
|
|
private func updateValueLabel() {
|
|
|
keychain.synchronizable = synchronizableSwitch.on
|
|
|
+// keychain.accessGroup = synchronizableSwitch.on ? ViewController.accessGroup : nil
|
|
|
|
|
|
if let value = keychain.get(TegKeychainDemo_keyName) {
|
|
|
valueLabel.text = "In Keychain: \(value)"
|