Swift
Generate Swift asset catalogs from DTCG tokens.
Setup
Requires Node.js 20 or later. With that installed, and a package.json, run:
npm i -D @terrazzo/cli @terrazzo/plugin-swiftAdd a terrazzo.config.js to the root of your project with:
import { defineConfig } from "@terrazzo/cli";
import swift from "@terrazzo/plugin-swift";
export default defineConfig({
outDir: "./tokens/",
plugins: [
swift({
catalogName: "Tokens",
}),
],
});Lastly, run:
npx tz buildAnd you’ll see a ./tokens/Tokens.xcassets catalog generated in your project. Import it into your project and you’ll have access to all your tokens!