iOS Developer Library — Prerelease

Developer

PassKit Framework Reference PKAddPassesViewController Class Reference

Options
Deployment Target:

On This Page
Language:

PKAddPassesViewController

The PKAddPassesViewController class lets your app show a pass and prompt the user to add that pass to the pass library.

To add multiple passes without presenting this view controller multiple times, use the addPasses:withCompletionHandler: method of PKPassLibrary.

  • Returns whether the device supports adding passes.

    Declaration

    Swift

    class func canAddPasses() -> Bool

    Objective-C

    + (BOOL)canAddPasses

    Return Value

    YEStrue if the device supports adding passes; otherwise, NOfalse.

    Availability

    Available in iOS 8.0 and later.

    See Also

    + isPassLibraryAvailable method of PKPassLibrary

  • Initializes and returns a newly created add-passes view controller with a single pass.

    Declaration

    Swift

    init(pass pass: PKPass)

    Objective-C

    - (instancetype _Nonnull)initWithPass:(PKPass * _Nonnull)pass

    Parameters

    pass

    The pass that is displayed.

    Return Value

    The initialized add-passes view controller object or nil if there was a problem initializing the object.

    Availability

    Available in iOS 6.0 and later.

  • Initializes and returns a newly created add-passes view controller with an array of passes.

    Declaration

    Swift

    init(passes passes: [PKPass])

    Objective-C

    - (instancetype _Nonnull)initWithPasses:(NSArray<PKPass *> * _Nonnull)passes

    Parameters

    passes

    The passes that are displayed.

    Return Value

    The initialized add-passes view controller object or nil if there was a problem initializing the object.

    Availability

    Available in iOS 7.0 and later.

  • The view controller’s delegate.

    Declaration

    Swift

    unowned(unsafe) var delegate: PKAddPassesViewControllerDelegate?

    Objective-C

    @property(nonatomic, assign) id< PKAddPassesViewControllerDelegate > _Nullable delegate

    Discussion

    For information about the protocol that the delegate must implement, see PKAddPassesViewControllerDelegate Protocol Reference.

    Availability

    Available in iOS 6.0 and later.