Class

PKPassLibrary

The PKPassLibrary class provides an interface to the user’s library of passes.

Overview

The PKPassLibrary is not thread-safe. Use instances of this class only on a single thread.

Symbols

Accessing Passes

class func isPassLibraryAvailable()

A Boolean value that indicates whether the pass library is available.

func passes()

Returns the passes in the user’s pass library to which the app has access.

func pass(withPassTypeIdentifier: String, serialNumber: String)

Returns the pass with the given pass type identifier and serial number.

func passes(of: PKPassType)

Returns the passes of the specified pass type.

Working with Passes

func containsPass(PKPass)

Indicates whether the user’s pass library contains the specified pass.

func remotePaymentPasses()

Returns a list of passes stored on a remote device.

func removePass(PKPass)

Removes the pass from the user’s pass library.

func replacePass(with: PKPass)

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

Adding Payment Passes

func canAddPaymentPass(withPrimaryAccountIdentifier: String)

A Boolean value that indicates whether the app can add a card to Apple Pay for the provided primary account identifier.

Activating Payment Passes

func activate(PKPaymentPass, withActivationCode: String, completion: (Bool, Error) -> Void)? = nil)

Activates a payment pass using the provided activation code.

Deprecated
class func isPaymentPassActivationAvailable()

A Boolean value that indicates whether the device supports adding payment passes.

Deprecated
func isPaymentPassActivationAvailable()

A Boolean value that indicates whether the device supports adding payment passes.

func openPaymentSetup()

Opens the user interface to set up credit cards for Apple Pay.

Suppress Automatic Pass Presentation

class func isSuppressingAutomaticPassPresentation()

Returns a Boolean value that indicates whether the system is suppressing the automatic presentation of Apple Pay passes.

Constants

Notification Keys

Keys used to get values from the user information dictionary of pass library notifications.

PKPassLibraryAddPassesStatus

Statuses used when adding passes to the pass library.

PKAutomaticPassPresentationSuppressionResult

The result of an attempt to suppress automatic pass presentation.

PKSuppressionRequestToken

A token representing a request to suppress the automatic presentation of payment passes.

Notifications

static let PKPassLibraryDidChange: PKPassLibraryNotificationName

Posted after the pass library has been changed.

static let PKPassLibraryRemotePaymentPassesDidChange: PKPassLibraryNotificationName

Posted when an Apple Pay card is added to or removed from a device that is paired with the current iOS device (for example, Apple Watch).

Relationships

Inherits From

Conforms To

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software