Sfoglia il codice sorgente

Add ObjC bridge and instructions

Evgenii Neumerzhitckii 9 anni fa
parent
commit
ab69741b3e
2 ha cambiato i file con 10 aggiunte e 0 eliminazioni
  1. 6 0
      Demo/KeychainSwiftCBridge.swift
  2. 4 0
      README.md

+ 6 - 0
Demo/KeychainSwiftCBridge.swift

@@ -1,3 +1,7 @@
+import Security
+import Foundation
+import KeychainSwift // You might need to remove these imports in your project
+
 /**
  
  This file can be used in your ObjC project if you want to use KeychainSwift Swift library.
@@ -19,6 +23,8 @@
  [keychain set:@"Hello World" forKey:@"my key"];
  NSString *value = [keychain get:@"my key"];
  
+ 3. You might need to remove `import KeychainSwift` import from this file in your project.
+ 
  */
 @objc public class KeychainSwiftCBridge: NSObject {
   let keychain = KeychainSwift()

+ 4 - 0
README.md

@@ -204,6 +204,10 @@ keychain.set("hello world", forKey: "my key")
 if keychain.lastResultCode != noErr { /* Report error */ }
 ```
 
+## Using KeychainSwift from Objective-C
+
+[This manual](https://github.com/evgenyneu/Auk/wiki/Using-Auk-in-Objective-C-project) describes how to use KeychainSwift in Objective-C apps.
+
 ## Known serious issue
 
 It [has been reported](https://github.com/marketplacer/keychain-swift/issues/15) that the library sometimes returns `nil`  instead of the stored Keychain value. The issue seems to be random and hard to reproduce. It may be connected with [the Keychain issue](https://forums.developer.apple.com/thread/4743) reported on Apple developer forums. If you experienced this problem feel free to create an issue so we can discuss it and find solutions.