One Logo Pool Ball
App Frameworks · IOS API REFERENCE

FoundationModels

Perform tasks with models that specialize in language understanding, structured output, and tool calling.

253 types

622 callable entries

125 skipped

83% entry coverage

Generated from iOS SDK 27.1. Availability is shown on each declaration; permissions and entitlements still apply.

Types

AnyDynamicInstructions

struct · iOS 27.0+

AnyDynamicInstructions.Body

typealias · iOS 27.0+

AnyDynamicInstructions.ForEach

typealias · iOS 27.0+

AnyDynamicInstructions.SessionProperty

typealias · iOS 27.0+

Array.PartiallyGenerated

typealias · iOS 26.0+

Attachment

struct · iOS 27.0+

Bool.PartiallyGenerated

typealias · iOS 26.0+

ConditionalDynamicInstructions

struct · iOS 27.0+

ConditionalDynamicInstructions.Body

typealias · iOS 27.0+

ConditionalDynamicInstructions.Branch

enum · iOS 27.0+

ConditionalDynamicInstructions.ForEach

typealias · iOS 27.0+

ConditionalDynamicInstructions.SessionProperty

typealias · iOS 27.0+

ContextOptions

struct · iOS 27.0+

ContextOptions.ReasoningLevel

enum · iOS 27.0+

ConvertibleFromGeneratedContent

protocol · iOS 26.0+

ConvertibleToGeneratedContent

protocol · iOS 26.0+

Decimal.PartiallyGenerated

typealias · iOS 26.0+

Double.PartiallyGenerated

typealias · iOS 26.0+

DynamicGenerationSchema

struct · iOS 26.0+

DynamicGenerationSchema.Property

struct · iOS 26.0+

DynamicInstructions

protocol · iOS 27.0+

DynamicInstructions.ForEach

typealias · iOS 27.0+

DynamicInstructions.SessionProperty

typealias · iOS 27.0+

DynamicInstructionsBuilder

struct · iOS 27.0+

DynamicInstructionsForEach

struct · iOS 27.0+

DynamicInstructionsForEach.Body

typealias · iOS 27.0+

DynamicInstructionsForEach.ForEach

typealias · iOS 27.0+

DynamicInstructionsForEach.SessionProperty

typealias · iOS 27.0+

EmptyDynamicInstructions

struct · iOS 27.0+

EmptyDynamicInstructions.Body

typealias · iOS 27.0+

EmptyDynamicInstructions.ForEach

typealias · iOS 27.0+

EmptyDynamicInstructions.SessionProperty

typealias · iOS 27.0+

Float.PartiallyGenerated

typealias · iOS 26.0+

Generable

protocol · iOS 26.0+

Generable.PartiallyGenerated

typealias · iOS 26.0+

GeneratedContent

struct · iOS 26.0+

GeneratedContent.Kind

enum · iOS 26.0+

GeneratedContent.ParsingError

struct · iOS 27.0+

GeneratedContent.PartiallyGenerated

typealias · iOS 26.0+

GenerationGuide

struct · iOS 26.0+

GenerationID

struct · iOS 26.0+

GenerationOptions

struct · iOS 26.0+

GenerationOptions.SamplingMode

struct · iOS 26.0+

GenerationOptions.SamplingMode.Kind

enum · iOS 27.0+

GenerationOptions.ToolCallingMode

struct · iOS 27.0+

GenerationOptions.ToolCallingMode.Kind

enum · iOS 27.0+

GenerationSchema

struct · iOS 26.0+

GenerationSchema.Property

struct · iOS 26.0+

GenerationSchema.SchemaError

enum · iOS 26.0+

GenerationSchema.SchemaError.Context

struct · iOS 26.0+

ImageAttachmentContent

struct · iOS 27.0+

ImageReference

struct · iOS 27.0+

ImageReference.PartiallyGenerated

struct · iOS 27.0+

ImageReference.PartiallyGenerated.ID

typealias · iOS 27.0+

Instructions

struct · iOS 26.0+

Instructions.Body

typealias · iOS 27.0+

Instructions.ForEach

typealias · iOS 27.0+

Instructions.SessionProperty

typealias · iOS 27.0+

InstructionsBuilder

struct · iOS 26.0+

InstructionsRepresentable

protocol · iOS 26.0+

Int.PartiallyGenerated

typealias · iOS 26.0+

LanguageModel

protocol · iOS 27.0+

LanguageModelCapabilities

struct · iOS 27.0+

LanguageModelCapabilities.Capability

struct · iOS 27.0+

LanguageModelError

enum · iOS 27.0+

LanguageModelError.ContextSizeExceeded

struct · iOS 27.0+

LanguageModelError.GuardrailViolation

struct · iOS 27.0+

LanguageModelError.RateLimited

struct · iOS 27.0+

LanguageModelError.Refusal

struct · iOS 27.0+

LanguageModelError.Timeout

struct · iOS 27.0+

LanguageModelError.UnsupportedCapability

struct · iOS 27.0+

LanguageModelError.UnsupportedGenerationGuide

struct · iOS 27.0+

LanguageModelError.UnsupportedLanguageOrLocale

struct · iOS 27.0+

LanguageModelError.UnsupportedTranscriptContent

struct · iOS 27.0+

LanguageModelExecutor

protocol · iOS 27.0+

LanguageModelExecutorGenerationChannel

struct · iOS 27.0+

LanguageModelExecutorGenerationChannel.AsyncIterator

struct · iOS 27.0+

LanguageModelExecutorGenerationChannel.AsyncIterator.Element

typealias · iOS 27.0+

LanguageModelExecutorGenerationChannel.Element

typealias · iOS 27.0+

LanguageModelExecutorGenerationChannel.Event

struct · iOS 27.0+

LanguageModelExecutorGenerationChannel.Metadata

struct · iOS 27.0+

LanguageModelExecutorGenerationChannel.Reasoning

struct · iOS 27.0+

LanguageModelExecutorGenerationChannel.Reasoning.Action

struct · iOS 27.0+

LanguageModelExecutorGenerationChannel.ReasoningSignature

struct · iOS 27.0+

LanguageModelExecutorGenerationChannel.Response

struct · iOS 27.0+

LanguageModelExecutorGenerationChannel.Response.Action

struct · iOS 27.0+

LanguageModelExecutorGenerationChannel.TextFragment

struct · iOS 27.0+

LanguageModelExecutorGenerationChannel.TextSegmentReplacement

struct · iOS 27.0+

LanguageModelExecutorGenerationChannel.ToolCalls

struct · iOS 27.0+

LanguageModelExecutorGenerationChannel.ToolCalls.Action

struct · iOS 27.0+

LanguageModelExecutorGenerationChannel.ToolCalls.ToolCall

struct · iOS 27.0+

LanguageModelExecutorGenerationChannel.ToolCalls.ToolCall.Action

struct · iOS 27.0+

LanguageModelExecutorGenerationChannel.ToolCalls.ToolCall.ArgumentsFragment

struct · iOS 27.0+

LanguageModelExecutorGenerationChannel.Usage

struct · iOS 27.0+

LanguageModelExecutorGenerationChannel.Usage.Input

struct · iOS 27.0+

LanguageModelExecutorGenerationChannel.Usage.Output

struct · iOS 27.0+

LanguageModelExecutorGenerationRequest

struct · iOS 27.0+

LanguageModelFeedback

struct · iOS 26.0+

LanguageModelFeedback.Issue

struct · iOS 26.0+

LanguageModelFeedback.Issue.Category

enum · iOS 26.0+

LanguageModelFeedback.Issue.Category.AllCases

typealias · iOS 26.0+

LanguageModelFeedback.Sentiment

enum · iOS 26.0+

LanguageModelFeedback.Sentiment.AllCases

typealias · iOS 26.0+

LanguageModelSession

class · iOS 26.0+

LanguageModelSession.AnyDynamicProfile

struct · iOS 27.0+

LanguageModelSession.AnyDynamicProfile.Body

typealias · iOS 27.0+

LanguageModelSession.AnyDynamicProfile.DynamicProfile

typealias · iOS 27.0+

LanguageModelSession.AnyDynamicProfile.Profile

typealias · iOS 27.0+

LanguageModelSession.AnyDynamicProfile.SessionProperty

typealias · iOS 27.0+

LanguageModelSession.ConditionalDynamicProfile

struct · iOS 27.0+

LanguageModelSession.ConditionalDynamicProfile.Body

typealias · iOS 27.0+

LanguageModelSession.ConditionalDynamicProfile.DynamicProfile

typealias · iOS 27.0+

LanguageModelSession.ConditionalDynamicProfile.Profile

typealias · iOS 27.0+

LanguageModelSession.ConditionalDynamicProfile.SessionProperty

typealias · iOS 27.0+

LanguageModelSession.DynamicProfile

protocol · iOS 27.0+

LanguageModelSession.DynamicProfile.DynamicProfile

typealias · iOS 27.0+

LanguageModelSession.DynamicProfile.Profile

typealias · iOS 27.0+

LanguageModelSession.DynamicProfile.SessionProperty

typealias · iOS 27.0+

LanguageModelSession.DynamicProfileBuilder

struct · iOS 27.0+

LanguageModelSession.DynamicProfileModifier

protocol · iOS 27.0+

LanguageModelSession.DynamicProfileModifier.Content

typealias · iOS 27.0+

LanguageModelSession.DynamicProfileModifier.DynamicProfile

typealias · iOS 27.0+

LanguageModelSession.DynamicProfileModifier.SessionProperty

typealias · iOS 27.0+

LanguageModelSession.DynamicProfileModifierContent

struct · iOS 27.0+

LanguageModelSession.DynamicProfileModifierContent.Body

typealias · iOS 27.0+

LanguageModelSession.DynamicProfileModifierContent.DynamicProfile

typealias · iOS 27.0+

LanguageModelSession.DynamicProfileModifierContent.Profile

typealias · iOS 27.0+

LanguageModelSession.DynamicProfileModifierContent.SessionProperty

typealias · iOS 27.0+

LanguageModelSession.Error

enum · iOS 27.0+

LanguageModelSession.GenerationError

enum · iOS 26.0+ · Deprecated in iOS 27.0

LanguageModelSession.GenerationError.Context

struct · iOS 26.0+

LanguageModelSession.GenerationError.Refusal

struct · iOS 26.0+

LanguageModelSession.ModifiedDynamicProfile

struct · iOS 27.0+

LanguageModelSession.ModifiedDynamicProfile.Body

typealias · iOS 27.0+

LanguageModelSession.ModifiedDynamicProfile.DynamicProfile

typealias · iOS 27.0+

LanguageModelSession.ModifiedDynamicProfile.Profile

typealias · iOS 27.0+

LanguageModelSession.ModifiedDynamicProfile.SessionProperty

typealias · iOS 27.0+

LanguageModelSession.Profile

struct · iOS 27.0+

LanguageModelSession.Profile.Body

typealias · iOS 27.0+

LanguageModelSession.Profile.DynamicProfile

typealias · iOS 27.0+

LanguageModelSession.Profile.Profile

typealias · iOS 27.0+

LanguageModelSession.Profile.SessionProperty

typealias · iOS 27.0+

LanguageModelSession.Response

struct · iOS 26.0+

LanguageModelSession.ResponseStream

struct · iOS 26.0+

LanguageModelSession.ResponseStream.AsyncIterator

struct · iOS 26.0+

LanguageModelSession.ResponseStream.AsyncIterator.Element

typealias · iOS 26.0+

LanguageModelSession.ResponseStream.Element

typealias · iOS 26.0+

LanguageModelSession.ResponseStream.Snapshot

struct · iOS 26.0+

LanguageModelSession.SessionProperty

struct · iOS 27.0+

LanguageModelSession.ToolCallError

struct · iOS 26.0+

LanguageModelSession.Usage

struct · iOS 27.0+

LanguageModelSession.Usage.Input

struct · iOS 27.0+

LanguageModelSession.Usage.Output

struct · iOS 27.0+

Never.Body

typealias · iOS 27.0+

Never.DynamicProfile

typealias · iOS 27.0+

Never.ForEach

typealias · iOS 27.0+

Never.PartiallyGenerated

typealias · iOS 26.0+

Never.Profile

typealias · iOS 27.0+

Never.SessionProperty

typealias · iOS 27.0+

Optional.Body

typealias · iOS 27.0+

Optional.ForEach

typealias · iOS 27.0+

Optional.PartiallyGenerated

typealias · iOS 26.0+

Optional.SessionProperty

typealias · iOS 27.0+

PrivateCloudComputeLanguageModel

class · iOS 27.0+

PrivateCloudComputeLanguageModel.Availability

enum · iOS 27.0+

PrivateCloudComputeLanguageModel.Availability.UnavailableReason

enum · iOS 27.0+

PrivateCloudComputeLanguageModel.Error

enum · iOS 27.0+

PrivateCloudComputeLanguageModel.Error.NetworkFailure

struct · iOS 27.0+

PrivateCloudComputeLanguageModel.Error.QuotaLimitReached

struct · iOS 27.0+

PrivateCloudComputeLanguageModel.Error.ServiceUnavailable

struct · iOS 27.0+

PrivateCloudComputeLanguageModel.Executor

struct · iOS 27.0+

PrivateCloudComputeLanguageModel.Executor.Configuration

struct · iOS 27.0+

PrivateCloudComputeLanguageModel.Executor.Model

typealias · iOS 27.0+

PrivateCloudComputeLanguageModel.QuotaUsage

struct · iOS 27.0+

PrivateCloudComputeLanguageModel.QuotaUsage.LimitIncreaseSuggestion

struct · iOS 27.0+

PrivateCloudComputeLanguageModel.QuotaUsage.Status

enum · iOS 27.0+

PrivateCloudComputeLanguageModel.QuotaUsage.Status.BelowLimit

struct · iOS 27.0+

PrivateCloudComputeLanguageModel.QuotaUsage.Status.LimitReached

struct · iOS 27.0+

Prompt

struct · iOS 26.0+

PromptBuilder

struct · iOS 26.0+

PromptRepresentable

protocol · iOS 26.0+

SessionPropertyKey

protocol · iOS 27.0+

SessionPropertyValues

class · iOS 27.0+

String.PartiallyGenerated

typealias · iOS 26.0+

SystemLanguageModel

class · iOS 26.0+

SystemLanguageModel.Adapter

struct · iOS 26.0+ · Deprecated in iOS 26.4 · Unavailable in iOS 27.0

SystemLanguageModel.Adapter.AssetError

enum · iOS 26.0+ · Deprecated in iOS 26.4

SystemLanguageModel.Adapter.AssetError.Context

struct · iOS 26.0+ · Deprecated in iOS 26.4

SystemLanguageModel.Availability

enum · iOS 26.0+

SystemLanguageModel.Availability.UnavailableReason

enum · iOS 26.0+

SystemLanguageModel.Error

enum · iOS 27.0+

SystemLanguageModel.Error.AssetsUnavailable

struct · iOS 27.0+

SystemLanguageModel.Executor

struct · iOS 27.0+

SystemLanguageModel.Executor.Configuration

struct · iOS 27.0+

SystemLanguageModel.Executor.Model

typealias · iOS 27.0+

SystemLanguageModel.Guardrails

struct · iOS 26.0+

SystemLanguageModel.UseCase

struct · iOS 26.0+

SystemLanguageModel.Variant

struct · iOS 27.0+

Tool

protocol · iOS 26.0+

Tool.SessionProperty

typealias · iOS 27.0+

Transcript

struct · iOS 26.0+

Transcript.Attachment

enum · iOS 27.0+

Transcript.AttachmentSegment

struct · iOS 27.0+

Transcript.AttachmentSegment.ID

typealias · iOS 27.0+

Transcript.Element

typealias · iOS 27.0+

Transcript.Entry

enum · iOS 26.0+

Transcript.Entry.ID

typealias · iOS 26.0+

Transcript.HistoryView

struct · iOS 27.0+

Transcript.HistoryView.ArrayLiteralElement

typealias · iOS 27.0+

Transcript.HistoryView.Element

typealias · iOS 27.0+

Transcript.HistoryView.Index

struct · iOS 27.0+

Transcript.HistoryView.Index.Stride

typealias · iOS 27.0+

Transcript.HistoryView.Indices

typealias · iOS 27.0+

Transcript.HistoryView.Iterator

typealias · iOS 27.0+

Transcript.HistoryView.SubSequence

typealias · iOS 27.0+

Transcript.ImageAttachment

struct · iOS 27.0+

Transcript.Index

typealias · iOS 26.0+

Transcript.Indices

typealias · iOS 26.0+

Transcript.Instructions

struct · iOS 26.0+

Transcript.Instructions.ID

typealias · iOS 26.0+

Transcript.Iterator

typealias · iOS 26.0+

Transcript.Prompt

struct · iOS 26.0+

Transcript.Prompt.ID

typealias · iOS 26.0+

Transcript.Reasoning

struct · iOS 27.0+

Transcript.Reasoning.ID

typealias · iOS 27.0+

Transcript.Response

struct · iOS 26.0+

Transcript.Response.ID

typealias · iOS 26.0+

Transcript.ResponseFormat

struct · iOS 26.0+

Transcript.ResponseFormat.Kind

enum · iOS 27.0+

Transcript.Segment

enum · iOS 26.0+

Transcript.Segment.ID

typealias · iOS 26.0+

Transcript.StructuredSegment

struct · iOS 26.0+

Transcript.StructuredSegment.ID

typealias · iOS 26.0+

Transcript.SubSequence

typealias · iOS 27.0+

Transcript.TextSegment

struct · iOS 26.0+

Transcript.TextSegment.ID

typealias · iOS 26.0+

Transcript.ToolCall

struct · iOS 26.0+

Transcript.ToolCall.ID

typealias · iOS 26.0+

Transcript.ToolCalls

struct · iOS 26.0+

Transcript.ToolCalls.Element

typealias · iOS 26.0+

Transcript.ToolCalls.ID

typealias · iOS 26.0+

Transcript.ToolCalls.Index

typealias · iOS 26.0+

Transcript.ToolCalls.Indices

typealias · iOS 26.0+

Transcript.ToolCalls.Iterator

typealias · iOS 26.0+

Transcript.ToolCalls.SubSequence

typealias · iOS 26.0+

Transcript.ToolDefinition

struct · iOS 26.0+

Transcript.ToolOutput

struct · iOS 26.0+

Transcript.ToolOutput.ID

typealias · iOS 26.0+

TranscriptErrorHandlingPolicy

struct · iOS 27.0+

TupleDynamicInstructions

struct · iOS 27.0+

TupleDynamicInstructions.Body

typealias · iOS 27.0+

TupleDynamicInstructions.ForEach

typealias · iOS 27.0+

TupleDynamicInstructions.SessionProperty

typealias · iOS 27.0+

Functions and constants

get · iOS 27.0+

promptRepresentation

TypeScript
get promptRepresentation(): Prompt
Swift declaration
var promptRepresentation: Prompt { get }

An instance that represents a prompt.

get · iOS 27.0+

instructionsRepresentation

TypeScript
get instructionsRepresentation(): Instructions
Swift declaration
var instructionsRepresentation: Instructions { get }

An instance that represents the instructions.

method · iOS 27.0+

label

TypeScript
label(label: string): Attachment<unknown>
Swift declaration
func label(_ label: String) -> Attachment<Content>

Assigns a label to an attachment. Labels help the model identify specific attachments when making tool calls. ```swift Attachment(image) .label("profile-photo") ``` - Parameter label: A string that identifies this attachment.

init · iOS 27.0+

init

TypeScript
static initImageURLOrientation(imageURL: string, orientation?: (_ImageIO_CGImagePropertyOrientation) | null): Attachment<ImageAttachmentContent>
Swift declaration
init(imageURL: URL, orientation: CGImagePropertyOrientation? = nil)

Creates an attachment from a file URL pointing to an image. - Parameters: - imageURL: A URL to the image file to attach. - orientation: The orientation to apply to the image. Pass `nil` to use the image's natural orientation.

init · iOS 27.0+

init

TypeScript
static initOrientation(cgImage: _CoreGraphics_CGImage, orientation?: (_ImageIO_CGImagePropertyOrientation) | null): Attachment<ImageAttachmentContent>
Swift declaration
init(_ cgImage: CGImage, orientation: CGImagePropertyOrientation? = nil)

Creates an attachment from a Core Graphics image. - Parameters: - cgImage: The image to attach. - orientation: The orientation to apply to the image. Pass `nil` to use the image's natural orientation.

init · iOS 27.0+

init

TypeScript
static initOrientation19088(pixelBuffer: _CoreVideo_CVBuffer, orientation?: (_ImageIO_CGImagePropertyOrientation) | null): Attachment<ImageAttachmentContent>
Swift declaration
init(_ pixelBuffer: CVPixelBuffer, orientation: CGImagePropertyOrientation? = nil)

Creates an attachment from a pixel buffer. - Parameters: - pixelBuffer: The pixel buffer to attach. - orientation: The orientation to apply to the image. Pass `nil` to use the image's natural orientation.

init · iOS 27.0+

init

TypeScript
static initOrientation7102(ciImage: _CoreImage_CIImage, orientation?: (_ImageIO_CGImagePropertyOrientation) | null): Attachment<ImageAttachmentContent>
Swift declaration
init(_ ciImage: CIImage, orientation: CGImagePropertyOrientation? = nil)

Creates an attachment from a Core Image image. - Parameters: - ciImage: The image to attach. - orientation: The orientation to apply to the image. Pass `nil` to use the image's natural orientation.

static · iOS 26.0+

maximumCount

TypeScript
static maximumCount(count: number): GenerationGuide<Array<unknown>>
Swift declaration
static func maximumCount<Element>(_ count: Int) -> GenerationGuide<[Element]> where Value == [Element]

Enforces a maximum number of elements in the array. The bounds are inclusive. A `maximumCount` generation guide may be used when you want to ensure the model produces a number of array elements less than or equal to to some maximum value, such as the number of items in a game's shop. ```swift @Generable struct Shop { @Guide(description: "A creative name for a shop in a fantasy RPG") var name: String @Guide(description: "A list of items for sale", .maximumCount(10)) var inventory: [ShopItem] } ```

static · iOS 26.0+

minimumCount

TypeScript
static minimumCount(count: number): GenerationGuide<Array<unknown>>
Swift declaration
static func minimumCount<Element>(_ count: Int) -> GenerationGuide<[Element]> where Value == [Element]

Enforces a minimum number of elements in the array. The bounds are inclusive. A `minimumCount` generation guide may be used when you want to ensure the model produces a number of array elements greater than or equal to to some minimum value, such as the number of items in a game's shop. ```swift @Generable struct Shop { @Guide(description: "A creative name for a shop in a fantasy RPG") var name: String @Guide(description: "A list of items for sale", .minimumCount(3)) var inventory: [ShopItem] } ```

static · iOS 26.0+

count

TypeScript
static count(range: SDKHandle): GenerationGuide<Array<unknown>>
Swift declaration
static func count<Element>(_ range: ClosedRange<Int>) -> GenerationGuide<[Element]> where Value == [Element]

Enforces that the number of elements in the array falls within a closed range. Bounds are inclusive. A `count` generation guide may be used when you want to ensure the model produces a number of array elements that falls within a given range, such as the number of items in a game's shop. ```swift @Generable struct Shop { @Guide(description: "A creative name for a shop in a fantasy RPG") var name: String @Guide(description: "A list of items for sale", .count(2...10)) var inventory: [ShopItem] } ```

static · iOS 26.0+

count

TypeScript
static count21523(count: number): GenerationGuide<Array<unknown>>
Swift declaration
static func count<Element>(_ count: Int) -> GenerationGuide<[Element]> where Value == [Element]

Enforces that the array has exactly a certain number of elements. A `count` generation guide may be used when you want to ensure the model produces exactly a certain number array elements, such as the number of items in a game's shop. ```swift @Generable struct Shop { @Guide(description: "A creative name for a shop in a fantasy RPG") var name: String @Guide(description: "A list of items for sale", .count(3)) var inventory: [ShopItem] } ```

static · iOS 26.0+

element

TypeScript
static element(guide: GenerationGuide<unknown>): GenerationGuide<Array<unknown>>
Swift declaration
static func element<Element>(_ guide: GenerationGuide<Element>) -> GenerationGuide<[Element]> where Value == [Element]

Enforces a guide on the elements within the array. An `element` generation guide may be used when you want to apply guides to the values a model produces within an array. For example, you may want to generate an array of integers, where all the integers are in the range 0-9. ```swift @Generable struct FortuneCookie { @Guide(description: "A fortune from a fortune cookie") var name: String @Guide(description: "A list lucky numbers", .element(.range(0...9)), .count(4)) var luckyNumbers: [Int] } ```

static · iOS 26.0+

anyOf

TypeScript
static anyOf(values: Array<string>): GenerationGuide<string>
Swift declaration
static func anyOf(_ values: [String]) -> GenerationGuide<String>

Enforces that the string be one of the provided values.

static · iOS 26.0+

pattern

TypeScript
static pattern(regex: SDKHandle): GenerationGuide<string>
Swift declaration
static func pattern<Output>(_ regex: Regex<Output>) -> GenerationGuide<String>

Enforces that the string follows the pattern.

static · iOS 26.0+

constant

TypeScript
static constant(value: string): GenerationGuide<string>
Swift declaration
static func constant(_ value: String) -> GenerationGuide<String>

Enforces that the string be precisely the given value.

static · iOS 26.0+

range

TypeScript
static range(range: SDKHandle): GenerationGuide<number>
Swift declaration
static func range(_ range: ClosedRange<Double>) -> GenerationGuide<Double>

Enforces values that fall within a range. Bounds are inclusive. A `range` generation guide may be used when you want to ensure the model produces a value that falls in some range, such as the cost for an item in a game. ```swift @Generable struct ShopItem { @Guide(description: "A creative name for an item sold in a fantasy RPG") var name: String @Guide(description: "A cost for the item", .range(1...1000)) var cost: Double } ```

static · iOS 26.0+

maximum

TypeScript
static maximum(value: number): GenerationGuide<number>
Swift declaration
static func maximum(_ value: Double) -> GenerationGuide<Double>

Enforces a maximum value. Use a `maximum` generation guide --- whose bounds are inclusive --- to ensure the model produces a value less than or equal to some maximum value. For example, you can specify that the highest level a character in your game can achieve is 5000.0: ```swift @Generable struct GameCharacter { @Guide(description: "A creative name appropriate for a fantasy RPG character") var name: String @Guide(description: "A level for the character", .maximum(5000.0)) var level: Double } ```

static · iOS 26.0+

minimum

TypeScript
static minimum(value: number): GenerationGuide<number>
Swift declaration
static func minimum(_ value: Double) -> GenerationGuide<Double>

Enforces a minimum value. Use a `minimum` generation guide --- whose bounds are inclusive --- to ensure the model produces a value greater than or equal to some minimum value. For example, you can specify that all characters in your game start at level 1.0: ```swift @Generable struct GameCharacter { @Guide(description: "A creative name appropriate for a fantasy RPG character") var name: String @Guide(description: "A level for the character", .minimum(1.0)) var level: Double } ```

static · iOS 26.0+

range

TypeScript
static range38979(range: SDKHandle): GenerationGuide<number>
Swift declaration
static func range(_ range: ClosedRange<Float>) -> GenerationGuide<Float>

Enforces values that fall within a range. Bounds are inclusive. A `range` generation guide may be used when you want to ensure the model produces a value that falls in some range, such as the cost for an item in a game. ```swift @Generable struct ShopItem { @Guide(description: "A creative name for an item sold in a fantasy RPG") var name: String @Guide(description: "A cost for the item", .range(1...1000)) var cost: Float } ```

static · iOS 26.0+

maximum

TypeScript
static maximum19423(value: number): GenerationGuide<number>
Swift declaration
static func maximum(_ value: Float) -> GenerationGuide<Float>

Enforces a maximum value. Use a `maximum` generation guide --- whose bounds are inclusive --- to ensure the model produces a value less than or equal to some maximum value. For example, you can specify that the highest level a character in your game can achieve is 100.0: ```swift @Generable struct GameCharacter { @Guide(description: "A creative name appropriate for a fantasy RPG character") var name: String @Guide(description: "A level for the character", .maximum(100.0)) var level: Float } ```

static · iOS 26.0+

minimum

TypeScript
static minimum35033(value: number): GenerationGuide<number>
Swift declaration
static func minimum(_ value: Float) -> GenerationGuide<Float>

Enforces a minimum value. Use a `minimum` generation guide --- whose bounds are inclusive --- to ensure the model produces a value greater than or equal to some minimum value. For example, you can specify that all characters in your game start at level 1.0: ```swift @Generable struct GameCharacter { @Guide(description: "A creative name appropriate for a fantasy RPG character") var name: String @Guide(description: "A level for the character", .minimum(1.0)) var level: Float } ```

static · iOS 26.0+

range

TypeScript
static range61894(range: SDKHandle): GenerationGuide<number>
Swift declaration
static func range(_ range: ClosedRange<Int>) -> GenerationGuide<Int>

Enforces values that fall within a range. Use a `range` generation guide --- whose bounds are inclusive --- to ensure the model produces a value that falls within a range. For example, you can specify that the level of characters in your game are between 1 and 100: ```swift @Generable struct GameCharacter { @Guide(description: "A creative name appropriate for a fantasy RPG character") var name: String @Guide(description: "A level for the character", .range(1...100)) var level: Int } ```

static · iOS 26.0+

maximum

TypeScript
static maximum26712(value: number): GenerationGuide<number>
Swift declaration
static func maximum(_ value: Int) -> GenerationGuide<Int>

Enforces a maximum value. Use a `maximum` generation guide --- whose bounds are inclusive --- to ensure the model produces a value less than or equal to some maximum value. For example, you can specify that the highest level a character in your game can achieve is 100: ```swift @Generable struct GameCharacter { @Guide(description: "A creative name appropriate for a fantasy RPG character") var name: String @Guide(description: "A level for the character", .maximum(100)) var level: Int } ```

static · iOS 26.0+

minimum

TypeScript
static minimum75018(value: number): GenerationGuide<number>
Swift declaration
static func minimum(_ value: Int) -> GenerationGuide<Int>

Enforces a minimum value. Use a `minimum` generation guide --- whose bounds are inclusive --- to ensure the model produces a value greater than or equal to some minimum value. For example, you can specify that all characters in your game start at level 1: ```swift @Generable struct GameCharacter { @Guide(description: "A creative name appropriate for a fantasy RPG character") var name: String @Guide(description: "A level for the character", .minimum(1)) var level: Int } ```

static · iOS 26.0+

range

TypeScript
static range56578(range: SDKHandle): GenerationGuide<_Foundation_Decimal>
Swift declaration
static func range(_ range: ClosedRange<Decimal>) -> GenerationGuide<Decimal>

Enforces values that fall within a range. Bounds are inclusive. A `range` generation guide may be used when you want to ensure the model produces a value that falls in some range, such as the cost for an item in a game. ```swift @Generable struct ShopItem { @Guide(description: "A creative name for an item sold in a fantasy RPG") var name: String @Guide(description: "A cost for the item", .range(0.25...1000)) var cost: Decimal } ```

static · iOS 26.0+

maximum

TypeScript
static maximum79040(value: _Foundation_Decimal): GenerationGuide<_Foundation_Decimal>
Swift declaration
static func maximum(_ value: Decimal) -> GenerationGuide<Decimal>

Enforces a maximum value. Use a `maximum` generation guide --- whose bounds are inclusive --- to ensure the model produces a value less than or equal to some maximum value. For example, you can specify that the highest level a character in your game can achieve is 99.9: ```swift @Generable struct GameCharacter { @Guide(description: "A creative name appropriate for a fantasy RPG character") var name: String @Guide(description: "A level for the character", .maximum(99.9)) var level: Decimal } ```

static · iOS 26.0+

minimum

TypeScript
static minimum37386(value: _Foundation_Decimal): GenerationGuide<_Foundation_Decimal>
Swift declaration
static func minimum(_ value: Decimal) -> GenerationGuide<Decimal>

Enforces a minimum value. Use a `minimum` generation guide --- whose bounds are inclusive --- to ensure the model produces a value greater than or equal to some minimum value. For example, you can specify that all characters in your game start at level 0.75: ```swift @Generable struct GameCharacter { @Guide(description: "A creative name appropriate for a fantasy RPG character") var name: String @Guide(description: "A level for the character", .minimum(0.75)) var level: Decimal } ```

get · iOS 27.0+

wrappedValue

TypeScript
get wrappedValue(): unknown
Swift declaration
var wrappedValue: Value { get nonmutating set }

The wrapped value of this property wrapper.

set · iOS 27.0+

wrappedValue

TypeScript
set wrappedValue(value: unknown)
Swift declaration
var wrappedValue: Value { get nonmutating set }

The wrapped value of this property wrapper.

init · iOS 27.0+

init

TypeScript
static init(keyPath: SDKHandle): LanguageModelSession_SessionProperty<unknown>
Swift declaration
init(_ keyPath: ReferenceWritableKeyPath<SessionPropertyValues, Value>)

Creates a session property with the specified key path. - Parameters: - keyPath: The key path to the property.

method · iOS 26.0+

next

TypeScript
next(): Promise<(LanguageModelSession_ResponseStream_Snapshot<number>) | null>
Swift declaration
mutating func next(isolation actor: isolated (any Actor)? = #isolation) async throws -> LanguageModelSession.ResponseStream<Content>.Snapshot?

Asynchronously advances to the next element and returns it, or ends the sequence if there is no next element. - Returns: The next element, if it exists, or `nil` to signal the end of the sequence.

method · iOS 26.0+

makeAsyncIterator

TypeScript
makeAsyncIterator(): LanguageModelSession_ResponseStream_AsyncIterator<number>
Swift declaration
func makeAsyncIterator() -> LanguageModelSession.ResponseStream<Content>.AsyncIterator

Creates the asynchronous iterator that produces elements of this asynchronous sequence. - Returns: An instance of the `AsyncIterator` type used to produce elements of the asynchronous sequence.

method · iOS 26.0+

collect

TypeScript
collect(): Promise<LanguageModelSession_Response<number>>
Swift declaration
nonisolated(nonsending) func collect() async throws -> sending LanguageModelSession.Response<Content>

Returns the result from a streaming response, after it completes. If the streaming response was finished successfully before calling `collect()`, this method `Response` returns immediately. If the streaming response was finished with an error before calling `collect()`, this method propagates that error.

get · iOS 26.0+

rawContent

TypeScript
get rawContent(): GeneratedContent
Swift declaration
var rawContent: GeneratedContent

The raw content of the response. When `Content` is `GeneratedContent`, this is the same as `content`.

set · iOS 26.0+

rawContent

TypeScript
set rawContent(value: GeneratedContent)
Swift declaration
var rawContent: GeneratedContent

The raw content of the response. When `Content` is `GeneratedContent`, this is the same as `content`.

get · iOS 27.0+

transcriptEntries

TypeScript
get transcriptEntries(): SDKHandle
Swift declaration
var transcriptEntries: ArraySlice<Transcript.Entry>

The list of transcript entries.

set · iOS 27.0+

transcriptEntries

TypeScript
set transcriptEntries(value: SDKHandle)
Swift declaration
var transcriptEntries: ArraySlice<Transcript.Entry>

The list of transcript entries.

get · iOS 27.0+

usage

TypeScript
get usage(): LanguageModelSession_Usage
Swift declaration
var usage: LanguageModelSession.Usage

Information about how many tokens were used by this response.

set · iOS 27.0+

usage

TypeScript
set usage(value: LanguageModelSession_Usage)
Swift declaration
var usage: LanguageModelSession.Usage

Information about how many tokens were used by this response.

get · iOS 26.0+

content

TypeScript
get content(): unknown
Swift declaration
var content: Content.PartiallyGenerated

The content of the response.

set · iOS 26.0+

content

TypeScript
set content(value: unknown)
Swift declaration
var content: Content.PartiallyGenerated

The content of the response.

get · iOS 27.0+

body

TypeScript
get body(): never
Swift declaration
var body: Never { get }

The content of the dynamic profile.

get · iOS 27.0+

body

TypeScript
get body(): never
Swift declaration
var body: Never { get }

The content of the dynamic profile.

get · iOS 27.0+

body

TypeScript
get body(): never
Swift declaration
var body: Never { get }

The content of the dynamic profile.

get · iOS 26.0+

rawContent

TypeScript
get rawContent(): GeneratedContent
Swift declaration
let rawContent: GeneratedContent

The raw response content. When `Content` is `GeneratedContent`, this is the same as `content`.

get · iOS 26.0+

transcriptEntries

TypeScript
get transcriptEntries(): SDKHandle
Swift declaration
let transcriptEntries: ArraySlice<Transcript.Entry>

The list of transcript entries.

get · iOS 27.0+

usage

TypeScript
get usage(): LanguageModelSession_Usage
Swift declaration
let usage: LanguageModelSession.Usage

Information about how many tokens were used by this response.

get · iOS 26.0+

content

TypeScript
get content(): number
Swift declaration
let content: Content

The response content.

get · iOS 27.0+

body

TypeScript
get body(): never
Swift declaration
var body: Never { get }

The content of the dynamic instructions.

get · iOS 27.0+

body

TypeScript
get body(): never
Swift declaration
var body: Never { get }

The content of the dynamic instructions.

get · iOS 26.0+

generatedContent

TypeScript
get generatedContent(): GeneratedContent
Swift declaration
var generatedContent: GeneratedContent { get }

This instance represented as generated content. Conformance to this protocol is provided by the `@Generable` macro. You can provide a manual implementation to map values onto properties using different names. Use the generated content property as shown below, to manually return a new ``GeneratedContent`` with the properties you specify. ```swift struct Person: ConvertibleToGeneratedContent { var name: String var age: Int var generatedContent: GeneratedContent { GeneratedContent(properties: [ "firstName": name, "ageInYears": age ]) } } ``` - Important: If your type also conforms to ``ConvertibleFromGeneratedContent``, it is critical that this implementation be symmetrical with ``ConvertibleFromGeneratedContent/init(_:)``.

get · iOS 26.0+

generationSchema

TypeScript
static get generationSchema(): GenerationSchema
Swift declaration
static var generationSchema: GenerationSchema { get }

An instance of the generation schema.

get · iOS 26.0+

promptRepresentation

TypeScript
get promptRepresentation(): Prompt
Swift declaration
var promptRepresentation: Prompt { get }

An instance that represents a prompt.

get · iOS 26.0+

instructionsRepresentation

TypeScript
get instructionsRepresentation(): Instructions
Swift declaration
var instructionsRepresentation: Instructions { get }

An instance that represents the instructions.

init · iOS 26.0+

init

TypeScript
static init(content: GeneratedContent): _Foundation_Decimal
Swift declaration
init(_ content: GeneratedContent) throws

Creates an instance from content generated by a model. Conformance to this protocol is provided by the `@Generable` macro. You can provide a manual implementation to map values onto properties using different names. To manually initialize your type from generated content, decode the values as shown below: ```swift struct Person: ConvertibleFromGeneratedContent { var name: String var age: Int init(_ content: GeneratedContent) { self.name = try content.value(forProperty: "firstName") self.age = try content.value(forProperty: "ageInYears") } } ``` - Important: If your type also conforms to ``ConvertibleToGeneratedContent``, it is critical that this implementation be symmetrical with ``ConvertibleToGeneratedContent/generatedContent``. - SeeAlso: `@Generable` macro ``Generable(description:)``

Skipped declarations

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

SystemLanguageModel.tokenCount(for:)

This parameter hides a concrete Swift type.

AnyDynamicInstructions.init(erasing:)

This protocol needs associated types that cannot yet cross the bridge.

DynamicInstructionsBuilder.buildExpression(_:)

This protocol needs associated types that cannot yet cross the bridge.

DynamicInstructionsBuilder.buildExpression(_:)

This declaration needs Swift generic type arguments. (no canonical witness for T)

DynamicInstructionsBuilder.buildExpression(_:)

This protocol needs associated types that cannot yet cross the bridge.

DynamicInstructionsBuilder.buildBlock(_:)

Swift parameter packs cannot cross the bridge.

DynamicInstructionsBuilder.buildBlock(_:)

This declaration needs Swift generic type arguments. (no canonical witness for T)

DynamicInstructionsBuilder.buildEither(first:)

This declaration needs Swift generic type arguments. (no canonical witness for TrueContent)

DynamicInstructionsBuilder.buildEither(second:)

This declaration needs Swift generic type arguments. (no canonical witness for FalseContent)

DynamicInstructionsBuilder.buildOptional(_:)

This declaration needs Swift generic type arguments. (no canonical witness for Content)

DynamicInstructionsBuilder.buildLimitedAvailability(_:)

This protocol needs associated types that cannot yet cross the bridge.

TupleDynamicInstructions.init(_:)

Swift parameter packs cannot cross the bridge.

ConditionalDynamicInstructions.init(_:)

The containing type needs Swift generic type arguments. (no canonical witness for TrueContent, FalseContent)

DynamicInstructionsForEach.init(_:id:content:)

This declaration needs Swift generic type arguments. (no canonical witness for Data)

DynamicInstructionsForEach.init(_:content:)

This declaration needs Swift generic type arguments. (no canonical witness for Data)

LanguageModelSession.AnyDynamicProfile.init(erasing:)

This protocol needs associated types that cannot yet cross the bridge.

LanguageModelSession.Profile.init(_:)

This protocol needs associated types that cannot yet cross the bridge.

LanguageModelSession.DynamicProfileBuilder.buildBlock(_:)

This declaration needs Swift generic type arguments. (no canonical witness for T)

LanguageModelSession.DynamicProfileBuilder.buildEither(first:)

This declaration needs Swift generic type arguments. (no canonical witness for TrueContent)

LanguageModelSession.DynamicProfileBuilder.buildEither(second:)

This declaration needs Swift generic type arguments. (no canonical witness for FalseContent)

LanguageModelSession.DynamicProfileBuilder.buildLimitedAvailability(_:)

This protocol needs associated types that cannot yet cross the bridge.

LanguageModelSession.init(profile:history:)

This protocol needs associated types that cannot yet cross the bridge.

LanguageModelSession.DynamicProfile.modifier(_:)

This declaration needs Swift generic type arguments. (no canonical witness for Modifier)

LanguageModelSession.DynamicProfile.model(_:)

This protocol needs associated types that cannot yet cross the bridge.

LanguageModelSession.DynamicProfile.model(_:)

This protocol needs associated types that cannot yet cross the bridge.

LanguageModelSession.DynamicProfile.temperature(_:)

This protocol needs associated types that cannot yet cross the bridge.

LanguageModelSession.DynamicProfile.samplingMode(_:)

This protocol needs associated types that cannot yet cross the bridge.

LanguageModelSession.DynamicProfile.maximumResponseTokens(_:)

This protocol needs associated types that cannot yet cross the bridge.

LanguageModelSession.DynamicProfile.reasoningLevel(_:)

This protocol needs associated types that cannot yet cross the bridge.

LanguageModelSession.DynamicProfile.toolCallingMode(_:)

This protocol needs associated types that cannot yet cross the bridge.