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 when someone initiates an action that generates a single pass, like purchasing a concert ticket, or multiple passes, like checking into a multiconnection flight. Your app adds the pass to the person’s Wallet automatically with PKPassLibrary.Capability.backgroundAddPasses, or they receive a prompt to confirm the overall action or review the passes individually. If you want to the person to review individual passes visually before adding them, use an instance of PKAddPassesViewController.

See Also

Automatically adding passes