---
title: luna generate
description: Write a typed Swift client for the public luna types of the app in this folder.
related:
  - /clients/generate-a-typed-client
  - /clients/call-lunas-from-swift
---

`luna generate swift` writes a Swift file with a typed client for each public luna type of the app in this folder.

```bash
luna generate swift
```

## Reference

```bash
luna generate [OPTIONS] <LANGUAGE>
```

| Option | Type | Default | Does |
| --- | --- | --- | --- |
| `<LANGUAGE>` | text | Required | The language to write. `swift` is the only one. |
| `--dir <DIR>` | path | `.` | The app's folder: where `luna.config.ts` is, or the folder whose `luna` folder has it. |
| `--out <OUT>` | path | `LunaClients.swift` in the app's folder | The file to write. |

## Good to know

- `luna generate` reads your code on this machine and never reaches Luna. It loads the app with Node.js through the installed TypeScript SDK, as `luna deploy` does.
- It rewrites the file only when its contents change.
- TypeScript apps need no generated client. They take their types from the luna type itself, as `client.luna<typeof List>`.

## Examples

### Write the Swift client into an Xcode project

```bash
luna generate swift --out ios/App/LunaClients.swift
```

### Write the client for an app in another folder

```bash
luna generate swift --dir backend
```
