Instance Method

addPasses(_:withCompletionHandler:)

Presents lightweight UI for adding multiple passes at once.

Declaration

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

Parameters

passes

The passes being added.

completion

The completion block called after the user selects an action. This block takes the following parameter:

status

A PKPassLibraryAddPassesStatus value that indicates whether the passes were added. If the user selects to review the passes, this status is set to PKPassLibraryAddPassesStatus.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 multi-connection flight). The user is asked to confirm the overall action or 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 and Removing Passes

enum PKPassLibraryAddPassesStatus

Statuses used when adding passes to the pass library.

func canAddFelicaPass() -> Bool

Returns a Boolean value that indicates whether the library can add Felica passes.

func removePass(PKPass)

Removes the pass from the user’s pass library.

func replacePass(with: PKPass) -> Bool

Replaces a pass in the user’s pass library with the given pass.