prepareInterface(for:)
Prepares the interface to display a prompt to generate passwords based on developer-specified rules.
Declaration
func prepareInterface(for generatePasswordsRequest: ASGeneratePasswordsRequest)Discussion
The system calls this method to tell your extension’s view controller to prepare to present a prompt to generate passwords. After calling this method, the system presents the view controller to the user.
Upon success, call completeGeneratePasswordRequest(results:completionHandler:).
Always provide a way for someone to cancel the operation from your view controller, for example, by including a Cancel button in the navigation bar. When someone cancels the operation, call ASCredentialProviderExtensionContext/cancelRequest(with:), using userCanceled.
Support of this feature is implied by default when adding support for generating passwords. You can opt out of showing UI by adding the SupportsGeneratePasswordCredentialsWithUI under the ASCredentialProviderExtensionCapabilities dictionary. When opting out, you must provide a value of false as the default value for this field is true. When you opt out, the OS will provide a relevant experience after requesting generated passwords from your extension.
Info.plist
├─ NSExtension
├─ NSExtensionAttributes
├─ ASCredentialProviderExtensionCapabilities
├─ SupportsSavePasswordCredentials => true
├─ SupportsGeneratePasswordCredentials => true
├─ SupportsGeneratePasswordCredentialsWithUI => true