Evgenii Neumerzhitckii 9 anni fa
parent
commit
c774062c12
1 ha cambiato i file con 7 aggiunte e 0 eliminazioni
  1. 7 0
      Demo/ViewController.swift

+ 7 - 0
Demo/ViewController.swift

@@ -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)"