luna generate
Write a typed Swift client for the public luna types of the app in this folder.
luna generate swift writes a Swift file with a typed client for each public luna type of the app in this folder.
luna generate swift
Reference
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 generatereads your code on this machine and never reaches Luna. It loads the app with Node.js through the installed TypeScript SDK, asluna deploydoes.- 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
luna generate swift --out ios/App/LunaClients.swift
Write the client for an app in another folder
luna generate swift --dir backend