Contents.json File
Contents.json
files encode the attributes for elements represented by folders in the hierarchy. Each folder can contain one Contents.json
file that encodes the attributes for the asset or group it contains. For information on which folder types require the file, see Table 5-2.
.json Format
The information in a Contents.json
file is represented by pairs of tags and values using standard .json
format. The general structure of the file is:
"<tag-name>" : <value>
"<tag-name>" : <value>
…
"<tag-name>" : <value>
The tag name is an attribute of the asset catalog or asset file. For example, the filename
attribute is the filename for a specific image or icon. The value of the tag depends on the type of the tag.
Tag Types
Table 3-1 describes the tag types that Contents.json
can contain.
Type |
Value |
Format |
---|---|---|
Array |
An array of items of the same type. |
|
Boolean |
A Boolean value of true or false. |
|
Dictionary |
A list of associations between keys and values. |
|
Enum |
A group of related values. |
|
Number |
A numerical value. |
|
String |
A string value. |
|
Slot component |
A special type of enum. |
See Slot Components below. |
For information on the tags and possible values for each type of folder, see the details for each type in the Type Reference.
Slot Components
A slot component is a special type of tag used to create an identifier for the elements in an asset type. The identifier is a combination of the values for each slot component tag for an element. The identifiers must be unique for elements in the same named asset type folder. Items in other named asset folders can use the same identifier.
For example, idiom
, scale
, subtype
, screen-width
, width-class
, and height-class
are the slot component tags for the image set asset type. There can be only one combination of "idiom": "universal"
, "scale": "3x"
, "subtype": ""
, "screen-width": ""
, "width-class": ""
, "height-class": "regular"
, for the mountain-llama
image. The same combination can be used for the norwegian-blue-parrot
image.
Copyright © 2018 Apple Inc. All rights reserved. Terms of Use | Privacy Policy | Updated: 2018-04-09