Condition
The object for defining a condition that, when met, causes conditional properties to go into effect.
Declaration
object ConditionProperties
| Name | Type | Description |
|---|---|---|
app | string | The application in which a person views the Apple News article. Valid values:
|
following | (boolean | string) | A Boolean or a string value to indicate whether the person viewing the article is following the channel that published the article. When you set the value to |
horizontalSizeClass | string | A string describing the width at which Apple News displays the article. The value indicates whether iOS considers the article width constrained ( |
maxColumns | integer | The maximum number of columns in which Apple News displays the article. When a person views the article with the specified number of columns or fewer, the conditional properties are in effect. For more information about the column system, see Planning the Layout for Your Article. |
maxContentSizeCategory | string | A string indicating a dynamic type size at which Apple News displays the article. When the article is displayed at the specified size or smaller, the conditional properties are in effect. The default content size category in iOS and macOS is |
maxSpecVersion | string | An Apple News Format version that an Apple News client can use to display an article. When the Apple News Format version is equal to or less than the specified value, the conditional properties are in effect. |
maxViewportAspectRatio | float | A number indicating a width divided by a height. When the aspect ratio of the person’s viewport is the specified value or smaller, the conditional properties are in effect. |
maxViewportWidth | integer | A number indicating width in points. When the width of the person’s viewport is the specified value or smaller, the conditional properties are in effect. |
minColumns | integer | The minimum number of columns in which Apple News displays the article. When a person views the article with the specified number of columns or more, the conditional properties are in effect. For more information about the column system, see Planning the Layout for Your Article. |
minContentSizeCategory | string | A string indicating a dynamic type size at which Apple News displays the text in the article. When Apple News displays the article at the specified dynamic type size or greater, the conditional properties are in effect. The default content size category in iOS and macOS is |
minSpecVersion | string | An Apple News Format version that can be used by an Apple News client that is displaying an article. When the Apple News Format version is equal to or greater than the specified value, the conditional properties are in effect. |
minViewportAspectRatio | float | A number indicating a width divided by a height. When the aspect ratio of the person’s viewport is the specified value or greater, the conditional properties are in effect. |
minViewportWidth | integer | A number indicating the width in points. When the width of the person’s viewport is the specified value or greater, the conditional properties are in effect. |
platform | string | A platform on which a person can view an article. When the person views the article on the specified platform, the conditional properties are in effect. |
preferredColorScheme | string | A string describing the person’s preferred color theme for the system. Valid values:
|
subscriptionStatus | string | The type of subscription the person has. When the subscription is of the specified type, the conditional properties are in effect. |
verticalSizeClass | string | A string describing the height at which Apple News displays the article. The value indicates whether iOS considers the article width constrained ( |
territory | string | The territory of the person. When the value is specified, the conditional properties are in effect. |
viewLocation | string | The context of the article. When the context is of the specified type, the conditional properties are in effect. |
Mentioned in
Discussion
Use the Condition object to define the condition under which the associated properties are applied.
You can use this object in ConditionalComponent, ConditionalContainer, ConditionalSection, ConditionalText, ConditionalComponentLayout, ConditionalComponentStyle, ConditionalComponentTextStyle, ConditionalTextStyle, ConditionalDocumentStyle, ConditionalDivider, and ConditionalAutoPlacement.
Example
{
"components": [
{
"role": "photo",
"URL": "bundle://summer.jpg",
"layout": "exampleLayout",
"caption": "Thanks to the record drought, mountain lions have begun to descend from the peaks.",
"hidden": false,
"conditional": {
"hidden": true,
"conditions": {
"maxViewportWidth": 320
}
}
}
],
"componentLayouts": {
"exampleLayout": {
"ignoreDocumentMargin": true,
"conditional": [
{
"ignoreDocumentMargin": false,
"conditions": [
{
"minViewportWidth": 768
}
]
}
]
}
}
}