Guides and Sample Code

Developer

Asset Catalog Format Reference

On This Page

Format Overview

Asset catalogs simplify access to app resources by mapping between named assets and one or more files targeted for different device attributes. Attributes include device characteristics, size classes, on-demand resources, and type-specific information. The attributes are used to choose the best file for app slicing variants, and at runtime to choose the right image for the current screen orientation.

For more information on asset catalogs, see Asset catalogs in Xcode Help. For more information on app slicing, see App Thinning (iOS, watchOS).

Asset Catalog Contents

The different kinds of elements in an asset catalog are shown in Figure 1-1.

Figure 1-1Asset catalog elements image: Art/ACR_Asset_Catalog_Elements_2x.png

The contents of an asset catalog include:

  • Groups. A group can contain one or more assets and one or more groups.

  • Assets. An asset is a set of files and the associated attributes for one named asset of a single type.

    • Asset names are the developer-defined strings used to access the asset.

    • Asset files are the resource or data files for a named asset.

  • Attributes. An attribute is a characteristic of a group, asset, or asset file.

  • Asset variations. An asset variation is a single sliced variant of one named asset that is based on the set of assigned attribute values. For more information on slicing, see Slicing (iOS).

General Format

The contents of an asset catalog, mentioned in the previous section, are organized into these parts:

  • Folders. A folder can contain an asset and a group. The name of a folder containing an asset includes the name of the asset and the type of the asset. Group folder names do not have a type extension. The hierarchy of folders is used for the hierarchy of the asset catalog.

  • JSON files. A .json file contains the attributes for an asset, a group of assets, or the asset catalog.

  • Content files. A content file is a resource or data file for one variation of one asset.