Contents

addPasses(_:withCompletionHandler:)

Presents a user interface for adding multiple passes at once.

Declaration

func addPasses(_ passes: [PKPass], withCompletionHandler completion: (@Sendable (PKPassLibraryAddPassesStatus) -> Void)? = nil)
func addPasses(_ passes: [PKPass]) async -> PKPassLibraryAddPassesStatus

Parameters

  • passes:

    The passes to add.

  • completion:

    The completion handler that PassKit calls after the user selects an action. This handler takes the following parameter:

    status

    A Pkpasslibraryaddpassesstatus value that indicates whether PassKit adds the passes. If the user selects to review the passes, PassKit sets the status to Shouldreviewpasses. In this case, you must present an instance of Pkaddpassesviewcontroller to let the user review and add the passes.

Discussion

Use this method whenever the user initiates an action that generates a single pass (like purchasing a concert ticket) or multiple passes (like checking into a multiconnection flight). The user receives a prompt to confirm the overall action or to review the passes individually. If you want to force the user to review individual passes visually before adding them, use an instance of PKAddPassesViewController.

See Also

Adding passes