@@ -16,6 +16,19 @@ This creates a `.exfig/schemas/` directory with all schema files (`ExFig.pkl`, `
1616` Android.pkl ` , ` Flutter.pkl ` , ` Web.pkl ` ). Your config file references these schemas via ` amends ` and ` import `
1717statements.
1818
19+ Alternatively, you can reference schemas directly via the published PKL package URI (no local extraction needed):
20+
21+ ``` pkl
22+ amends "package://github.com/alexey1312/ExFig/releases/download/v2.0.0/exfig@2.0.0#/ExFig.pkl"
23+
24+ import "package://github.com/alexey1312/ExFig/releases/download/v2.0.0/exfig@2.0.0#/iOS.pkl"
25+ import "package://github.com/alexey1312/ExFig/releases/download/v2.0.0/exfig@2.0.0#/Figma.pkl"
26+ import "package://github.com/alexey1312/ExFig/releases/download/v2.0.0/exfig@2.0.0#/Common.pkl"
27+ ```
28+
29+ Replace ` 2.0.0 ` with your ExFig version. Using local schemas (` exfig schemas ` ) is recommended for faster evaluation
30+ and offline support.
31+
1932## Quick Start
2033
2134Generate a working configuration file for your platform:
@@ -309,13 +322,16 @@ ios = new iOS.iOSConfig {
309322| ------------------------ | ------------------ | -------- | ------------------------------------------------------ |
310323| ` xcodeprojPath ` | ` String ` | Yes | Path to ` .xcodeproj ` file |
311324| ` target ` | ` String ` | Yes | Xcode target for resources and Swift code |
312- | ` xcassetsPath ` | ` String ` | Yes | Path to ` Assets.xcassets ` directory |
325+ | ` xcassetsPath ` | ` String? ` | No * | Path to ` Assets.xcassets ` directory |
313326| ` xcassetsInMainBundle ` | ` Boolean ` | Yes | Whether assets are in the main bundle |
314327| ` xcassetsInSwiftPackage ` | ` Boolean? ` | No | Whether assets are in a Swift package (default: false) |
315328| ` resourceBundleNames ` | ` Listing<String>? ` | No | Resource bundle names for SPM packages |
316329| ` addObjcAttribute ` | ` Boolean? ` | No | Add ` @objc ` to generated properties (default: false) |
317330| ` templatesPath ` | ` String? ` | No | Path to custom Stencil templates |
318331
332+ * Required when exporting colors (with ` useColorAssets ` ), icons, or images. Can be omitted in base configs used only
333+ for inheritance.
334+
319335### iOS Colors
320336
321337``` pkl
@@ -1002,6 +1018,52 @@ configuration.
10021018
10031019---
10041020
1021+ ## Common PKL Patterns
1022+
1023+ ### Union Types: Single vs. Multiple Entries
1024+
1025+ ExFig schema fields like ` colors ` , ` icons ` , and ` images ` accept either a single entry or a ` Listing ` (array). PKL
1026+ cannot infer the type from ` new { ... } ` for union types, so you must use the typed constructor when writing multiple
1027+ entries.
1028+
1029+ ** Single entry** — type is inferred, no explicit type needed:
1030+
1031+ ``` pkl
1032+ colors = new iOS.ColorsEntry {
1033+ figmaFrameName = "Colors"
1034+ useColorAssets = true
1035+ assetsFolder = "Colors"
1036+ nameStyle = "camelCase"
1037+ }
1038+ ```
1039+
1040+ ** Multiple entries** — MUST use typed constructor (` new Type { ... } ` ):
1041+
1042+ ``` pkl
1043+ colors = new Listing {
1044+ new iOS.ColorsEntry {
1045+ figmaFrameName = "Light Colors"
1046+ useColorAssets = true
1047+ assetsFolder = "Colors/Light"
1048+ nameStyle = "camelCase"
1049+ }
1050+ new iOS.ColorsEntry {
1051+ figmaFrameName = "Dark Colors"
1052+ useColorAssets = true
1053+ assetsFolder = "Colors/Dark"
1054+ nameStyle = "camelCase"
1055+ }
1056+ }
1057+ ```
1058+
1059+ Without the typed constructor (e.g., ` new { ... } ` inside a Listing), PKL will report:
1060+ ` Expected type iOS.ColorsEntry, but got Dynamic ` .
1061+
1062+ This pattern applies to all platforms: ` iOS.ColorsEntry ` , ` iOS.IconsEntry ` , ` iOS.ImagesEntry ` ,
1063+ ` Android.ColorsEntry ` , ` Android.IconsEntry ` , ` Android.ImagesEntry ` , ` Flutter.ColorsEntry ` , etc.
1064+
1065+ ---
1066+
10051067## Validation
10061068
10071069Validate your config file before running exports:
0 commit comments