One Logo Pool Ball
FoundationModels · IOS API REFERENCE

DynamicGenerationSchema

struct · iOS 26.0+ · SDK 27.1

struct DynamicGenerationSchema

The dynamic counterpart to the generation schema type that you use to construct schemas at runtime. An individual schema may reference other schemas by name, and references are resolved when converting a set of dynamic schemas into a ``GenerationSchema``.

Members (7)

init · iOS 26.0+

init

TypeScript
static initReferenceTo(name: string): DynamicGenerationSchema
Swift declaration
init(referenceTo name: String)

Creates a reference schema. - Parameters: - name: The name of the ``DynamicGenerationSchema`` this is a reference to.

init · iOS 26.0+

init

TypeScript
static initNameDescriptionProperties(name: string, description: (string) | null, properties: Array<DynamicGenerationSchema_Property>): DynamicGenerationSchema
Swift declaration
init(name: String, description: String? = nil, properties: [DynamicGenerationSchema.Property])

Creates an object schema. - Parameters: - name: A name this dynamic schema can be referenced by. - description: A natural language description of this schema. - properties: The properties associated with this schema.

init · iOS 26.4+

init

TypeScript
static initNameDescriptionRepresentNilExplicitlyInGeneratedContentProperties(name: string, description: (string) | null, explicitNil: boolean, properties: Array<DynamicGenerationSchema_Property>): DynamicGenerationSchema
Swift declaration
init(name: String, description: String? = nil, representNilExplicitlyInGeneratedContent explicitNil: Bool, properties: [DynamicGenerationSchema.Property])

Creates an object schema. - Parameters: - name: A name this dynamic schema can be referenced by. - description: A natural language description of this schema. - representNilExplicitlyInGeneratedContent: If `true`, the model represents `nil` explicitly. - properties: The properties associated with this schema.

init · iOS 26.0+

init

TypeScript
static initNameDescriptionAnyOf(name: string, description: (string) | null, choices: Array<DynamicGenerationSchema>): DynamicGenerationSchema
Swift declaration
init(name: String, description: String? = nil, anyOf choices: [DynamicGenerationSchema])

Creates an any-of schema. - Parameters: - name: A name this schema can be referenced by. - description: A natural language description of this ``DynamicGenerationSchema``. - choices: An array of schemas this one will be a union of.

init · iOS 26.0+

init

TypeScript
static initNameDescriptionAnyOf6353(name: string, description: (string) | null, choices: Array<string>): DynamicGenerationSchema
Swift declaration
init(name: String, description: String? = nil, anyOf choices: [String])

Creates an enum schema. - Parameters: - name: A name this schema can be referenced by. - description: A natural language description of this ``DynamicGenerationSchema``. - choices: An array of strings this one will be a union of.

get · iOS 26.4+

null

TypeScript
static get null(): DynamicGenerationSchema
Swift declaration
static var null: DynamicGenerationSchema { get }

Creates a null schema. You can use null schemas as a way to express types that cannot be absent, but may have an empty value. let person = DynamicGenerationSchema( name: "Person", properties: [] DynamicGenerationSchema.Property( name: "fullName", schema: DynamicGenerationSchema(type: String.self) ) ] ) let nullablePerson = DynamicGenerationSchema( name: "NullablePerson", anyOf: [person, .null] ) let schema = try GenerationSchema(root: nullablePerson, dependencies: [])

init · iOS 26.0+

init

TypeScript
static initArrayOfMinimumElementsMaximumElements(itemSchema: DynamicGenerationSchema, minimumElements?: (number) | null, maximumElements?: (number) | null): DynamicGenerationSchema
Swift declaration
init(arrayOf itemSchema: DynamicGenerationSchema, minimumElements: Int? = nil, maximumElements: Int? = nil)

Creates an array schema. - Parameters: - itemSchema: A schema to use as the elements of the array. - minimumElements: A minimum number of elements the array should contain. - maximumElements: The maximum number of element the array should contain.

Skipped declarations

1 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

DynamicGenerationSchema.init(type:guides:)

Passing a Swift type itself is not supported.

All FoundationModels types →