iOS Developer Library — Pre-Release

Developer

PassKit Framework Reference PKAddPassesViewController Class Reference

Options
Deployment Target:

On This Page
Language:

PKAddPassesViewController

Inheritance


Conforms To


Import Statement


Swift

import PassKit

Objective-C

@import PassKit;

Availability


Available in iOS 6.0 and later.

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.

    Import Statement

    Objective-C

    @import PassKit;

    Swift

    import PassKit

    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: AnyObject!)

    Objective-C

    - (instancetype)initWithPass:(id)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.

    Import Statement

    Objective-C

    @import PassKit;

    Swift

    import PassKit

    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: [AnyObject]!)

    Objective-C

    - (instancetype)initWithPasses:(NSArray *)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.

    Import Statement

    Objective-C

    @import PassKit;

    Swift

    import PassKit

    Availability

    Available in iOS 7.0 and later.

  • delegate delegate Property

    The view controller’s delegate.

    Declaration

    Swift

    unowned(unsafe) var delegate: PKAddPassesViewControllerDelegate!

    Objective-C

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

    Discussion

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

    Import Statement

    Objective-C

    @import PassKit;

    Swift

    import PassKit

    Availability

    Available in iOS 6.0 and later.