Contents

performAutoFillAssistedRequest(_:)

Performs an AutoFill-assisted authorization request.

Declaration

@MainActor func performAutoFillAssistedRequest(_ request: ASAuthorizationRequest) async throws -> ASAuthorizationResult

Parameters

  • request:

    The authorization request to perform.

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 request when the view appears:

.task {
    // Create the authorization request.
    async let request = makeAutoFillAuthorizationRequest()
    // Perform the request and await its result.
    let result = try await authorizationController
        .performAutoFillAssistedRequest(request)
    switch result {
        // Process the request's result.
    }
}

See Also

Performing assisted requests