Skip to content

pantoken / platforms/swift/src / toSwift

Swyddogaeth: toSwift()

toSwift(tokens, options): Promise<string>

Arbrofol

Allbynnwch Swift ar gyfer IR tocyn penodol.

Paramedrau

tokens

darllen-yn-unig Token[]

options

GenerateSwiftOptions

Yn dychwelyd

Promise<string>

Llwybr y ffeil Swift a ysgrifennwyd.

Enghreifftiau

Generu IR thema penodol

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 { … })

Modd tywyll gyda enw dosbarth wedi'i haddasu a chatalog asedau

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
});