One Logo Pool Ball
AppIntents · IOS API REFERENCE

TypeDisplayRepresentation

struct · iOS 16.0+ · SDK 27.1

struct TypeDisplayRepresentation

A type that describes the user interface presentation of a custom type.

Members (9)

get · iOS 16.0+

numericFormat

TypeScript
get numericFormat(): (_Foundation_LocalizedStringResource) | null
Swift declaration
var numericFormat: LocalizedStringResource?

A string representing a count for the type, e.g. "2 books". In your `numericFormat` implementation, use `StringInterpolation` placeholders and provide a `.stringsdict` file with all possible pluralizations for the type, such as "0 books", "1 book", and "2 books". Example: ``` TypeDisplayRepresentation( name: LocalizedStringResource("Book"), numericFormat: LocalizedStringResource("\(placeholder: .int) books") ) ``` ``` <dict> <key>Book</key> <dict> <key>NSStringLocalizedFormatKey</key> <string>%#@VARIABLE@</string> <key>VARIABLE</key> <dict> <key>NSStringFormatSpecTypeKey</key> <string>NSStringPluralRuleType</string> <key>one</key> <string>Book</string> <key>other</key> <string>Books</string> </dict> </dict> <key>%lld books</key> <dict> <key>NSStringLocalizedFormatKey</key> <string>%#@count@</string> <key>count</key> <dict> <key>NSStringFormatSpecTypeKey</key> <string>NSStringPluralRuleType</string> <key>NSStringFormatValueTypeKey</key> <string>lld</string> <key>zero</key> <string>%lld books</string> <key>one</key> <string>%lld book</string> <key>other</key> <string>%lld books</string> </dict> </dict> </dict> ```

set · iOS 16.0+

numericFormat

TypeScript
set numericFormat(value: (_Foundation_LocalizedStringResource) | null)
Swift declaration
var numericFormat: LocalizedStringResource?

A string representing a count for the type, e.g. "2 books". In your `numericFormat` implementation, use `StringInterpolation` placeholders and provide a `.stringsdict` file with all possible pluralizations for the type, such as "0 books", "1 book", and "2 books". Example: ``` TypeDisplayRepresentation( name: LocalizedStringResource("Book"), numericFormat: LocalizedStringResource("\(placeholder: .int) books") ) ``` ``` <dict> <key>Book</key> <dict> <key>NSStringLocalizedFormatKey</key> <string>%#@VARIABLE@</string> <key>VARIABLE</key> <dict> <key>NSStringFormatSpecTypeKey</key> <string>NSStringPluralRuleType</string> <key>one</key> <string>Book</string> <key>other</key> <string>Books</string> </dict> </dict> <key>%lld books</key> <dict> <key>NSStringLocalizedFormatKey</key> <string>%#@count@</string> <key>count</key> <dict> <key>NSStringFormatSpecTypeKey</key> <string>NSStringPluralRuleType</string> <key>NSStringFormatValueTypeKey</key> <string>lld</string> <key>zero</key> <string>%lld books</string> <key>one</key> <string>%lld book</string> <key>other</key> <string>%lld books</string> </dict> </dict> </dict> ```

init · iOS 16.0+

init

TypeScript
static initStringLiteral(value: string): TypeDisplayRepresentation
Swift declaration
init(stringLiteral value: String)

Creates an instance initialized to the given string value. - Parameter value: The value of the new instance.

get · iOS 16.0+

name

TypeScript
get name(): _Foundation_LocalizedStringResource
Swift declaration
var name: LocalizedStringResource

The singular type name, e.g. "Book".

set · iOS 16.0+

name

TypeScript
set name(value: _Foundation_LocalizedStringResource)
Swift declaration
var name: LocalizedStringResource

The singular type name, e.g. "Book".

init · iOS 17.0+

init

TypeScript
static initNameNumericFormatSynonyms(name: _Foundation_LocalizedStringResource, numericFormat?: (_Foundation_LocalizedStringResource) | null, synonyms?: Array<_Foundation_LocalizedStringResource>): TypeDisplayRepresentation
Swift declaration
init(name: LocalizedStringResource, numericFormat: LocalizedStringResource? = nil, synonyms: [LocalizedStringResource] = [])
init · iOS 16.0+

init

TypeScript
static initNameNumericFormat(name: _Foundation_LocalizedStringResource, numericFormat?: (_Foundation_LocalizedStringResource) | null): TypeDisplayRepresentation
Swift declaration
init(name: LocalizedStringResource, numericFormat: LocalizedStringResource? = nil)
get · iOS 17.0+

synonyms

TypeScript
get synonyms(): Array<_Foundation_LocalizedStringResource>
Swift declaration
var synonyms: [LocalizedStringResource]

A list of localized phrases that are synonyms of this particular type display representation Example: ``` struct PizzaEntity: AppEntity { static var typeDisplayRepresentation = TypeDisplayRepresentation( name: "Pizza", synonyms: ["Pie", "Za"] ) } ``` In this case, we are saying that PizzaEntity can be represented as "Pizza", "Pie" or "Za"

set · iOS 17.0+

synonyms

TypeScript
set synonyms(value: Array<_Foundation_LocalizedStringResource>)
Swift declaration
var synonyms: [LocalizedStringResource]

A list of localized phrases that are synonyms of this particular type display representation Example: ``` struct PizzaEntity: AppEntity { static var typeDisplayRepresentation = TypeDisplayRepresentation( name: "Pizza", synonyms: ["Pie", "Za"] ) } ``` In this case, we are saying that PizzaEntity can be represented as "Pizza", "Pie" or "Za"

Skipped declarations

No declarations were skipped in this snapshot.

All AppIntents types →