title: clear value in keychain when user logout
body: <p>I want to remove keychain value form my service, when user has logout. However, I feel confused about the best practice way to do that.</p>
  
  <p>Here is my service</p>
  
  <pre><code>let userAccount = "AuthenticatedUser"
  let accessGroup = "SecuritySerivice"
  
  let passwordKey = "KeyForPassword"
  
  let kSecClassValue = NSString(format: kSecClass)
  let kSecAttrAccountValue = NSString(format: kSecAttrAccount)
  let kSecValueDataValue = NSString(format: kSecValueData)
  let kSecClassGenericPasswordValue = NSString(format: kSecClassGenericPassword)
  let kSecAttrServiceValue = NSString(format: kSecAttrService)
  let kSecMatchLimitValue = NSString(format: kSecMatchLimit)
  let kSecReturnDataValue = NSString(format: kSecReturnData)
  let kSecMatchLimitOneValue = NSString(format: kSecMatchLimitOne)
  
  public class KeychainService: NSObject {
  
      public class func savePassword(token: String) {
          self.save(service: passwordKey, data: token)
      }
  
      public class func loadPassword() -&gt; String? {
          return self.load(service: passwordKey)
      }
  
      public class func removePassword() {
  
      }
  
      private class func save(service: String, data: String) {
          let dataFromString: Data = data.data(using: String.Encoding(rawValue: String.Encoding.utf8.rawValue), allowLossyConversion: false)!
  
          let keychainQuery: NSMutableDictionary = NSMutableDictionary(objects: [kSecClassGenericPasswordValue, service, userAccount, dataFromString], forKeys: [kSecClassValue, kSecAttrServiceValue, kSecAttrAccountValue, kSecValueDataValue])
  
          SecItemDelete(keychainQuery as CFDictionary)
  
          SecItemAdd(keychainQuery as CFDictionary, nil)
      }
  
      private class func load(service: String) -&gt; String? {
  
          let keychainQuery: NSMutableDictionary = NSMutableDictionary(objects: [kSecClassGenericPasswordValue, service, userAccount, kCFBooleanTrue, kSecMatchLimitOneValue], forKeys: [kSecClassValue, kSecAttrServiceValue, kSecAttrAccountValue, kSecReturnDataValue, kSecMatchLimitValue])
  
          var dataTypeRef :AnyObject?
  
          // Search for the keychain items
          let status: OSStatus = SecItemCopyMatching(keychainQuery, &amp;dataTypeRef)
          var contentsOfKeychain: String? = nil
  
          if status == errSecSuccess {
              if let retrievedData = dataTypeRef as? Data {
                  contentsOfKeychain = String(data: retrievedData, encoding: String.Encoding.utf8)
              }
          } else {
              print("KEY: Nothing was retrieved from the keychain. Status code \(status)")
          }
  
          return contentsOfKeychain
      }
  
      private class func remove(service: String) {
  
      }
  
  }
  </code></pre>
  
  <p>Obviously, I'm not shure whether I should remove anything form keychain actually</p>