Hi everyone! I’m new here!
I am trying to create a Password Management app. I noticed that online there are very few resources that help you do that. Specifically, there are almost no detailed resources on implementing the AutoFill Credential Provider Extension.
There’s the video of the WWDC where they presented this feature, but don’t explain in detail how to use it.
Is there someone that has already done it that could help me?
Right now, I added the AutoFill Credential Provider capability as well as the AutoFill Credential Provider extension, which right now looks like this:
import AuthenticationServices
class CredentialProviderViewController: ASCredentialProviderViewController {
override func prepareCredentialList(for serviceIdentifiers: [ASCredentialServiceIdentifier]) {
}
override func provideCredentialWithoutUserInteraction(for credentialIdentity: ASPasswordCredentialIdentity) {
let databaseIsUnlocked = true
if (databaseIsUnlocked) {
let passwordCredential = ASPasswordCredential(user: "j_appleseed", password: "apple1234")
self.extensionContext.completeRequest(withSelectedCredential: passwordCredential, completionHandler: nil)
} else {
self.extensionContext.cancelRequest(withError: NSError(domain: ASExtensionErrorDomain, code:ASExtensionError.userInteractionRequired.rawValue))
}
}
override func prepareInterfaceToProvideCredential(for credentialIdentity: ASPasswordCredentialIdentity) {
}
@IBAction func cancel(_ sender: AnyObject?) {
self.extensionContext.cancelRequest(withError: NSError(domain: ASExtensionErrorDomain, code: ASExtensionError.userCanceled.rawValue))
}
@IBAction func passwordSelected(_ sender: AnyObject?) {
let passwordCredential = ASPasswordCredential(user: "j_appleseed", password: "apple1234")
self.extensionContext.completeRequest(withSelectedCredential: passwordCredential, completionHandler: nil)
}
}
All of this was pre-written, but on the line
} else {
self.extensionContext.cancelRequest(withError: NSError(domain: ASExtensionErrorDomain, code:ASExtensionError.userInteractionRequired.rawValue))
}
I get the yellow warning “Will never be executed”. Can someone help me understand how this extension works? Or is there a guide that I can follow? I can’t find any nor on this website nor elsewhere on the internet.