Skip to content

Instantly share code, notes, and snippets.

@philipshen
Last active August 20, 2019 02:39
Show Gist options
  • Save philipshen/8ae7084fa5863576fdda3e5973d1862a to your computer and use it in GitHub Desktop.
Save philipshen/8ae7084fa5863576fdda3e5973d1862a to your computer and use it in GitHub Desktop.
let query: [String:Any] = [
kSecClass as String: kSecClassGenericPassword,
kSecAttrSynchronizable as String: kCFBooleanFalse,
kSecAttrAccount as String: "accountName".data(using: .utf8)!,
kSecReturnData as String: kCFBooleanTrue
]
var result: AnyObject?
let status: OSStatus = withUnsafeMutablePointer(to: &result) {
SecItemCopyMatching(query as CFDictionary, UnsafeMutablePointer($0))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment