<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "PassKit",
  "identifier" : "/documentation/PassKit/PKPass/init(data:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "PassKit (Apple Pay and Wallet)"
    ],
    "preciseIdentifier" : "c:objc(cs)PKPass(im)initWithData:error:"
  },
  "title" : "init(data:)"
}
-->

# init(data:)

Creates a pass using the data you provide.

```
init(data: Data) throws
```

## Parameters

`data`

A signed pass.

## Discussion

If there’s a problem encoding the data you supply, this method sets the `error` parameter based on the type of problem:

- The pass contains invalid data—this method throws the [`PKPassKitError.Code.invalidDataError`](/documentation/PassKit/PKPassKitError/Code/invalidDataError) error.
- The signature of the pass is invalid—this method throws the [`PKPassKitError.Code.invalidSignature`](/documentation/PassKit/PKPassKitError/Code/invalidSignature) error.
- For other types of errors, `localizedDescription` contains a string suitable for presentation to the user.

Check the console for more detailed information.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)