Ver Fonte

Update README (code samples)

kishikawa katsumi há 9 anos atrás
pai
commit
7e2edd771c
1 ficheiros alterados com 8 adições e 8 exclusões
  1. 8 8
      README.md

+ 8 - 8
README.md

@@ -225,7 +225,7 @@ print(attributes.creator)
 let keychain = Keychain(service: "com.example.github-token")
 let keychain = Keychain(service: "com.example.github-token")
     .label("github.com (kishikawakatsumi)")
     .label("github.com (kishikawakatsumi)")
     .synchronizable(true)
     .synchronizable(true)
-    .accessibility(.AfterFirstUnlock)
+    .accessibility(.afterFirstUnlock)
 ```
 ```
 
 
 #### <a name="accessibility"> Accessibility
 #### <a name="accessibility"> Accessibility
@@ -254,7 +254,7 @@ let keychain = Keychain(service: "com.example.github-token")
 
 
 do {
 do {
     try keychain
     try keychain
-        .accessibility(.AfterFirstUnlock)
+        .accessibility(.afterFirstUnlock)
         .set("01234567-89ab-cdef-0123-456789abcdef", key: "kishikawakatsumi")
         .set("01234567-89ab-cdef-0123-456789abcdef", key: "kishikawakatsumi")
 } catch let error {
 } catch let error {
     print("error: \(error)")
     print("error: \(error)")
@@ -279,7 +279,7 @@ let keychain = Keychain(service: "com.example.github-token")
 
 
 do {
 do {
     try keychain
     try keychain
-        .accessibility(.WhenUnlocked)
+        .accessibility(.whenUnlocked)
         .set("01234567-89ab-cdef-0123-456789abcdef", key: "kishikawakatsumi")
         .set("01234567-89ab-cdef-0123-456789abcdef", key: "kishikawakatsumi")
 } catch let error {
 } catch let error {
     print("error: \(error)")
     print("error: \(error)")
@@ -354,11 +354,11 @@ If the item not protected, the `authenticationPrompt` parameter just be ignored.
 ```swift
 ```swift
 let keychain = Keychain(service: "com.example.github-token")
 let keychain = Keychain(service: "com.example.github-token")
 
 
-dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) {
+DispatchQueue.global(qos: DispatchQoS.QoSClass.default).async {
     do {
     do {
         // Should be the secret invalidated when passcode is removed? If not then use `.WhenUnlocked`
         // Should be the secret invalidated when passcode is removed? If not then use `.WhenUnlocked`
         try keychain
         try keychain
-            .accessibility(.WhenPasscodeSetThisDeviceOnly, authenticationPolicy: .UserPresence)
+            .accessibility(.whenPasscodeSetThisDeviceOnly, authenticationPolicy: .userPresence)
             .authenticationPrompt("Authenticate to update your access token")
             .authenticationPrompt("Authenticate to update your access token")
             .set("01234567-89ab-cdef-0123-456789abcdef", key: "kishikawakatsumi")
             .set("01234567-89ab-cdef-0123-456789abcdef", key: "kishikawakatsumi")
     } catch let error {
     } catch let error {
@@ -376,7 +376,7 @@ If the item not protected, the `authenticationPrompt` parameter just be ignored.
 ```swift
 ```swift
 let keychain = Keychain(service: "com.example.github-token")
 let keychain = Keychain(service: "com.example.github-token")
 
 
-dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) {
+DispatchQueue.global(qos: DispatchQoS.QoSClass.default).async {
     do {
     do {
         let password = try keychain
         let password = try keychain
             .authenticationPrompt("Authenticate to login to server")
             .authenticationPrompt("Authenticate to login to server")
@@ -493,7 +493,7 @@ print("\(keychain)")
 #### Obtaining all stored keys
 #### Obtaining all stored keys
 
 
 ```swift
 ```swift
-let keychain = Keychain(server: "https://github.com", protocolType: .HTTPS)
+let keychain = Keychain(server: "https://github.com", protocolType: .https)
 
 
 let keys = keychain.allKeys()
 let keys = keychain.allKeys()
 for key in keys {
 for key in keys {
@@ -511,7 +511,7 @@ key: honeylemon
 #### Obtaining all stored items
 #### Obtaining all stored items
 
 
 ```swift
 ```swift
-let keychain = Keychain(server: "https://github.com", protocolType: .HTTPS)
+let keychain = Keychain(server: "https://github.com", protocolType: .https)
 
 
 let items = keychain.allItems()
 let items = keychain.allItems()
 for item in items {
 for item in items {