Apple simplifies AI work in Swift with the @Generable and @Guide macros

Apple has shown how FoundationModels shortens the path from prompt to a ready-made data structure. The @Generable macro marks a Swift model as suitable for generation, while @Guide refines individual fields. The developer ends up with a stream of typed objects that can go straight into SwiftUI, with no manual parsing of the model's response. That cuts boilerplate code and makes integrating an LLM into an interface noticeably more practical.

AI-processed from Habr AI; edited by Hamidun News
Apple simplifies AI work in Swift with the @Generable and @Guide macros
Source: Habr AI. Collage: Hamidun News.
Listen to article

FoundationModels for Swift now includes the @Generable and @Guide macros, which make it easier for developers to work with language models: instead of raw text from the neural network, developers get ready-made objects with the structure they need, which the compiler prepares automatically.

How do you use language models in Swift development?

Apple has added the @Generable and @Guide macros. The developer marks a data structure once, and the language model automatically creates ready-made typed objects instead of raw text.

How do you embed AI in a Swift app?

Use the @Generable and @Guide macros from FoundationModels. The developer marks a data structure, and the compiler prepares instructions for the language model, which returns ready-made typed objects instead of raw text.

What is the @Generable macro?

A built-in Swift tool that marks a structure as suitable for AI generation. The compiler prepares everything the language model needs to create instances of that type and deliver them as a stream.

What does the @Generable macro do in Swift?

@Generable marks a data structure as suitable for generation by a language model. The developer defines types and properties once, and the model returns ready-made objects on its own instead of raw text, while the compiler prepares everything needed to stream the instances.

Story

Key Questions Answered

How do you use language models in Swift development?

Apple has added the @Generable and @Guide macros. The developer marks a data structure once, and the language model automatically creates ready-made typed objects instead of raw text.

How do you embed AI in a Swift app?

Use the @Generable and @Guide macros from FoundationModels. The developer marks a data structure, and the compiler prepares instructions for the language model, which returns ready-made typed objects instead of raw text.

What is the @Generable macro?

A built-in Swift tool that marks a structure as suitable for AI generation. The compiler prepares everything the language model needs to create instances of that type and deliver them as a stream.

What does the @Generable macro do in Swift?

@Generable marks a data structure as suitable for generation by a language model. The developer defines types and properties once, and the model returns ready-made objects on its own instead of raw text, while the compiler prepares everything needed to stream the instances.

ZK
Zhemal Khamidun — CPO at Alpina Digital, product manager of AlpinaGPT. Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Unified AI Workspace · Nomad

Test Frontier LLMs & Autonomous Agents in One Workspace

Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.

Try Nomad AI →Launch Nomad Agent
What do you think?
Loading comments…