   public func delete(key: String) -> Bool {
     let prefixedKey = keyWithPrefix(key)
 
-    let query = [
+    var query: [String: NSObject] = [
       KeychainSwiftConstants.klass       : kSecClassGenericPassword,
       KeychainSwiftConstants.attrAccount : prefixedKey ]
     
+    query = addAccessGroupWhenPresent(query)
+    lastQueryParameters = query
+    
     let status: OSStatus = SecItemDelete(query as CFDictionaryRef)
     
     return status == noErr

  public static var valueData: String { return toString(kSecValueData) }
  public static var returnData: String { return toString(kSecReturnData) }
  public static var matchLimit: String { return toString(kSecMatchLimit) }

  /**
  

  var lastQueryParameters: [String: NSObject]? // Used by the unit tests

  var keyPrefix = "" // Can be useful in test.
  
  /**

  Specify an access group that will be used to access keychain items. Access groups can be used to share keychain items between applications. When access group value is nil all application access groups are being accessed. Access group name is used by all functions: set, get, delete and clear.

  */
  public var accessGroup: String?
  
  public init() { }
  
