|
|
@@ -54,11 +54,11 @@ Add `import KeychainSwift` to your source code if you used Carthage or CocoaPods
|
|
|
```Swift
|
|
|
let keychain = KeychainSwift()
|
|
|
|
|
|
-keychain.set("hello world", forKey: "my key") // Returns true on success
|
|
|
+keychain.set("hello world", forKey: "my key")
|
|
|
|
|
|
keychain.get("my key")
|
|
|
|
|
|
-keychain.delete("my key") // Returns true on success
|
|
|
+keychain.delete("my key")
|
|
|
|
|
|
keychain.clear() // Delete everything from app's Keychain
|
|
|
```
|
|
|
@@ -122,6 +122,18 @@ keychain.set("hello world", forKey: "hello")
|
|
|
// Value will be stored under "myTestKey_hello" key
|
|
|
```
|
|
|
|
|
|
+### Verify successful operation
|
|
|
+
|
|
|
+`set`, `delete` and `clear` method return true when the Keychain operation is successful.
|
|
|
+
|
|
|
+```Swift
|
|
|
+if keychain.set("hello world", forKey: "my key") {
|
|
|
+ // Keychain item is saved successfully
|
|
|
+} else {
|
|
|
+ // Report error
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
## Demo app
|
|
|
|
|
|
<img src="https://raw.githubusercontent.com/exchangegroup/keychain-swift/master/graphics/keychain-swift-demo.png" alt="Sacing and reading text from Keychaing in iOS and Swift" width="320">
|