---
id: 8699
lang: en
title: "Apple simplifies AI work in Swift with the @Generable and @Guide macros"
published_at: "2026-05-02 18:06:20"
source_name: "Habr AI"
source_url: "https://habr.com/ru/articles/1019392/?utm_campaign=1019392&utm_source=habrahabr&utm_medium=rss"
canonical_url: "https://news.hamidun.com/en/news/8699"
categories: ["llm"]
publisher: "AI News by Jemal Hamidun (news.hamidun.com)"
---

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

> **Краткая суть (BLUF):** 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.

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.

---
- **Первоисточник:** [Habr AI](https://habr.com/ru/articles/1019392/?utm_campaign=1019392&utm_source=habrahabr&utm_medium=rss)
- **Каноническая ссылка:** https://news.hamidun.com/en/news/8699
- **Экосистема автора:** [Бесплатный интенсив по вайбкодингу — предзапись в Нике](https://t.me/vibecodeguidebot?start=agent_intensive_news_md) · [Nomad AI](https://nomadnet.ai) · [Telegram @jemal_hamidun](https://t.me/jemal_hamidun)
