<!--
{
  "availability" : [
    "iOS: 26.2.0 -",
    "iPadOS: 26.2.0 -",
    "macCatalyst: 26.2.0 -",
    "visionOS: 26.2.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AuthenticationServices",
  "identifier" : "/documentation/AuthenticationServices/ASCredentialProviderViewController/prepareInterface(for:)-7ideq",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Authentication Services"
    ],
    "preciseIdentifier" : "c:objc(cs)ASCredentialProviderViewController(im)prepareInterfaceForGeneratePasswordsRequest:"
  },
  "title" : "prepareInterface(for:)"
}
-->

# prepareInterface(for:)

Prepares the interface to display a prompt to generate passwords based on developer-specified rules.

```
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:)`](/documentation/AuthenticationServices/ASCredentialProviderExtensionContext/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`](/documentation/AuthenticationServices/ASExtensionError/userCanceled).

> Note: This flow can only be initiated by the user. It will not be triggered from `-performGeneratePasswordsRequestWithoutUserInteraction:`

> Note: You should not update or replace any existing credentials when this API is called.

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
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)