xcassets
xcassets is a Rust library for parsing Xcode asset catalogs.
It reads a single .xcassets directory into a typed tree, keeps unsupported
folder types visible as opaque nodes, and reports non-fatal problems as
diagnostics instead of stopping at the first issue.
Repository: https://github.com/WendellXY/xcassets
What It Supports Today
The current parser has first-class support for:
- catalog roots
- groups
- image sets
- named color sets
- app icon sets
Other typed asset folders are preserved as Node::Opaque so callers can still
inspect the catalog tree without losing information.
Installation
Add the crate to your project:
Example
use ;
API Overview
The main entry point is:
ParseReport contains:
catalog: the parsedAssetCatalogdiagnostics: non-fatal issues found while parsing
ParseError is reserved for failures that prevent producing a report at all,
such as passing a non-directory path or a path that is not a .xcassets
catalog root.
Diagnostics
The parser currently emits diagnostics for cases like:
- missing required
Contents.json - invalid
Contents.json - missing referenced asset files
- unreadable files or directories
- unsupported typed asset folders
This makes the crate useful for tooling, validation, and migration workflows where partial results are still valuable.
Format Notes
The parser is intentionally lenient:
- root catalogs and groups may omit
Contents.json - supported nodes preserve unknown JSON fields in
extras - image renditions without
filenameare allowed - filenames with spaces or non-ASCII characters are supported
This matches real-world Xcode projects more closely than a strict schema-only approach.
Development
Run the test suite with:
You can also run the ignored smoke test against a real iOS project:
XCASSETS_REAL_PROJECT=/path/to/ios/project \
XCASSETS_REAL_PROJECT_LIMIT=25 \
This test walks the project tree, finds .xcassets catalogs, and verifies a
bounded set of them can be parsed without fatal failures. It defaults to 10
catalogs so it stays fast enough for normal development, and you can raise the
limit when you want a broader smoke pass.
License
MIT