performAutoFillAssistedRequests(_:)
Performs an AutoFill-assisted authorization request from the provided array.
Declaration
@MainActor func performAutoFillAssistedRequests(_ requests: [ASAuthorizationRequest]) async throws -> ASAuthorizationResultParameters
- requests:
An array of supported authorization requests.
Return Value
The request’s outcome. For more information, see ASAuthorizationResult.
Discussion
To perform AutoFill-assisted authorization requests, add the appropriate textContentType(_:) to any sign-in related fields, such as those for usernames and passwords:
TextField("Username", text: $username)
.textContentType(.username)Then use doc://com.apple.documentation/documentation/swiftui/view/task(priority:_:) or doc://com.apple.documentation/documentation/swiftui/view/task(id:priority:_:) to perform the requests when the view appears:
.task {
// Create the authorization requests.
async let requests = makeAutoFillAuthorizationRequests()
// Perform the request and await its result.
let result = try await authorizationController
.performAutoFillAssistedRequests(requests)
switch result {
// Process the request's result.
}
}