I am trying to achieve like, when user already have their account. When they try to enter username and password i need to show the bottom popup to save your password like website ask to save our credentials when we logging in safari. So if user tap on save let it save in key chain.
And next time when user tap of user name or password an autofill credentials will be given to user and select their credentials.
my code :
let server = "www.workBro.com"
let userName = userNameTF.text
let passWrd = passwordTF.text
let password = passWrd?.data(using: String.Encoding.utf8)
var query: [String: Any] = [kSecClass as String: kSecClassInternetPassword,
kSecAttrAccount as String: userName,
kSecAttrServer as String: self.server,
kSecValueData as String: password]
let status = SecItemAdd(query as CFDictionary, nil)
if status == errSecSuccess {
print("success")
} else {
print("fail")
}
My credentials got saved i got success. But it din ask for shall i save your password promt alert like what we get when we use mobile safari login with other sites.
Am i missing anything ?