One Logo Pool Ball
FoundationModels · IOS API REFERENCE

PromptBuilder

struct · iOS 26.0+ · SDK 27.1

@resultBuilder struct PromptBuilder

A type that represents a prompt builder.

Members (7)

static · iOS 26.0+

buildArray

TypeScript
static buildArray(prompts: Array<SDKHandle>): Prompt
Swift declaration
@export(implementation) static func buildArray(_ prompts: [some PromptRepresentable]) -> Prompt

Creates a builder with an array of prompts.

static · iOS 26.0+

buildEither

TypeScript
static buildEitherFirst(component: SDKHandle): Prompt
Swift declaration
@export(implementation) static func buildEither(first component: some PromptRepresentable) -> Prompt

Creates a builder with the first component.

static · iOS 26.0+

buildEither

TypeScript
static buildEitherSecond(component: SDKHandle): Prompt
Swift declaration
@export(implementation) static func buildEither(second component: some PromptRepresentable) -> Prompt

Creates a builder with the second component.

static · iOS 26.0+

buildOptional

TypeScript
static buildOptional(component?: (Prompt) | null): Prompt
Swift declaration
@export(implementation) static func buildOptional(_ component: Prompt?) -> Prompt

Creates a builder with an optional component.

static · iOS 26.0+

buildExpression

TypeScript
static buildExpression(expression: Prompt): Prompt
Swift declaration
@export(implementation) static func buildExpression(_ expression: Prompt) -> Prompt

Creates a builder with a prompt expression.

static · iOS 26.0+

buildExpression

TypeScript
static buildExpression41437(expression: number): number
Swift declaration
@export(implementation) static func buildExpression<P>(_ expression: P) -> P where P : PromptRepresentable

Creates a builder with an expression.

static · iOS 26.0+

buildLimitedAvailability

TypeScript
static buildLimitedAvailability(prompt: SDKHandle): Prompt
Swift declaration
@export(implementation) static func buildLimitedAvailability(_ prompt: some PromptRepresentable) -> Prompt

Creates a builder with a limited availability prompt.

Skipped declarations

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

PromptBuilder.buildBlock(_:)

Swift parameter packs cannot cross the bridge.

All FoundationModels types →