Skip to content

pantoken / platforms/swift/src / toSwift

Fonksiyon: toSwift()

toSwift(tokens, options): Promise<string>

Deneysel

Açık bir token IR'si için Swift üret.

Parametreler

tokens

salt okunur Token[]

options

GenerateSwiftOptions

Döndürür

Promise<string>

Yazılan Swift dosyasının yolu.

Örnekler

Belirli bir temanın IR'sini oluştur

ts
import { toSwift } from "@pantoken/swift";
import { byTheme } from "@pantoken/tokens";

const file = await toSwift(byTheme("canvas"), { outDir: "./Sources/Tokens" });
// writes Tokens.swift (class PanTokens { … })

Özel bir sınıf adı ve bir varlık kataloğu ile koyu mod

ts
import { toSwift } from "@pantoken/swift";
import { byTheme } from "@pantoken/tokens";

await toSwift(byTheme("rebrand"), {
  outDir: "./Sources/Tokens",
  mode: "dark",
  className: "InstUITokens",
  icons: ["add", "check"], // also emits Icons.xcassets
});