Professional Documents
Culture Documents
Wallet Passes Documentation / Wallet Passes / Creating the Source for a Pass API Changes: None
Essentials
O object LogEntries Create the source in a directory that you use to create the final distributable pass Bundle. For information on building a
pass from the source, see Building a Pass.
Personalized Passes
O object PersonalizationDictionary Create the Directory and add Files for the Pass
First create a directory to hold all the source files. The name of the directory is the name of the final pass file followed by
.pass. For example, Lift It Membership.pass is the name of the top-level directory for the source of the Lift It
membership pass.
Add the pass.json file that contains the information and metadata for the pass. For more information on the contents
of this file, see the top-level Pass object.
Filter /
The following figure shows the directory structure for a simple pass thatʼs localized for English and Simplified Chinese:
Some types of passes include other types of images, such as a background. For more information, see Pass Design and
Creation.
Add a directory at the top-level source directory of each pass for each localization. The name of the directory identifies
the language and an optional region:
For example, the name for the French localization directory is fr.lproj, and the name for the Simplified Chinese
directory is zh-Hans.lproj. For more information on language identifiers, see Understand the Language
Identifier.
Localize an image by adding the location-specific image files to each localization directory. For example, to add the
localized versions of the diamond logo shown above, add the English version of the logo@2x.png and logo@3x.png
files to the en.lproj folder and the Chinese version of the logo@2x.png and logo@3x.png files to the zh-Hans
.lproj folder. Each folder must contain the same number of resolutions for an image.
Note
Adding an image of the same name to the top-level folder of the pass overrides any localized versions. In addition,
the localized image of a pass may not update after adding the pass to Wallet.
The system always displays localized versions of these values, even when your pass doesnʼt contain localization folders
for the language. For example, the figure below shows a pass that contains localizations for English and Simplified
Chinese displayed on a device set to the Arabic language. The system only localizes the date:
The system localizes other strings on your pass using a strings file which contains a list of keys and associated localized
strings. Add localized strings to your pass in three steps:
Set the value of a displayed string in pass.json to a key, such as “OfferAmountLabel” for the label of the
offer amount field.
Add a line to each pass.strings file that sets a key you created in pass.json to the localized term.
For example, the following three code snippets show the code to localize the offer label and offer text of the passes
shown above to English and to Simplified Chinese.
Set the value of the strings in the PassFields.PrimaryFields object in the pass.json file to the keys you use to
show a localized string in the pass.strings files:
See Also
Essentials
Building a Pass
Build a distributable pass.
object Pass
An object that represents a pass.
Developer Documentation
Xcode Cloud Health & Fitness App Store Connect Apple Design Awards
SF Symbols In-App Purchase Certificates, IDs, & Profiles Apple Developer Academies
Machine Learning
Security
To view the latest developer news, visit News and Updates . Light Dark Auto
Copyright © 2024 Apple Inc. All rights reserved. Terms of Use Privacy Policy Agreements and Guidelines