---
title: "Why Xcode is not production"
lesson_id: "01"
---

# Why Xcode is not production

- **Lesson ID:** 01
- **Goal:** Separate a foreground Xcode demo from a production session. Name Metal GPU revoke, jetsam, and the two ship bugs.
- **Human lesson:** [01-xcode-is-not-production.html](01-xcode-is-not-production.html)

## Prerequisites

- A feature that runs MLX Swift generate in a SwiftUI app.
- Willingness to background the app during a run.

## Inputs, outputs, and artifacts

- **Inputs:** A green Run in Xcode and a user who will leave the app.
- **Outputs:** Two ship bugs: unknown `model_type`, and Metal work after the scene backgrounds.
- **Artifacts:** Three progressive Mermaid diagrams: foreground generate, scene leaves, Metal or process dies.

## Agent build steps

1. Say a debugger Run keeps the scene active. That is not a production session.
2. Say MLX Swift uses Metal. iOS can take the GPU when the scene is not active.
3. Say jetsam can kill a high-memory generate. The in-memory session is gone.
4. Draw three small Mermaid diagrams. Do not merge them into one mega diagram.
5. Name the two later lessons: register the architecture, then gate on `scenePhase`.
6. Link [Core AI vs Core ML vs MLX](../core-ai-vs-core-ml-vs-mlx/) and [The agent harness (and how to improve it)](../agent-harness-improve-loop/).

## Constraints

Keep the language simple, friendly, and literal. No quizzes, no em dashes, no invented WWDC sessions. Brand Edge FDE only. No generate Swift in this lesson.

## Key concepts

- A debugger Run keeps the scene active. A real user backgrounds the app mid-generate.
- MLX Swift uses Metal. iOS can revoke the GPU when the scene is not active.
- Jetsam can kill a high-memory generate process. The in-memory session does not survive.
- A missing `model_type` fails at load. A missing scene gate fails at Metal.

## Takeaways

- Do not treat a foreground Xcode demo as production.
- Name the two ship bugs: unknown architecture, and Metal work after background.
- Plan to cancel generate when the scene leaves the foreground.

## Acceptance checks

- Foreground demo vs background death is the main claim.
- Three progressive Mermaid diagrams and an Agent brief link are present.
- Core AI vs MLX framing is honest. No invented WWDC session.
- [ ] Proceed to [lesson 02 brief](02-set-up-xcode-and-mlx-swift.llms.md).
