Swift devs can now share Hugging Face caches with Python, ending duplicate downloads
Curated by the Inblix editorial team
Apple platform developers who’ve wrestled with loading large language models in their apps just got a major quality-of-life upgrade. A new library called swift-huggingface, available today as a standalone Swift package, completely rethinks how iOS, macOS, and other Swift apps talk to the Hugging Face Hub. The team behind it is addressing complaints that piled up after the swift-transformers 1.0 release earlier this year — chiefly that downloading multi-gigabyte model files was fragile, slow, and couldn’t be resumed if a connection dropped.
“Developers resorted to manually downloading models and bundling them with their apps — defeating the purpose of dynamic model loading,” the announcement notes. That’s a real pain point. The fix includes proper progress tracking on downloads and a resume function that picks up where a failed transfer left off, sidestepping the misery of re-downloading a corrupted 4GB blob. But the feature that will probably save developers the most disk space and time is the new Python-compatible cache. If you already pulled down a model using the Python transformers library or huggingface_hub CLI, your Swift app will see those files in the standard ~/.cache/huggingface/hub directory and use them directly. No more storing two copies of Llama on your SSD.
Authentication also gets a clean break from the previous confusion. Instead of guessing where tokens live, developers use an explicit TokenProvider pattern. Want to pull a token from the Keychain for a production app? There’s a provider for that. Need to auto-detect environment variables for CI? That’s the default. For user-facing apps, a full OAuth 2.0 implementation is baked in, handling the system browser sign-in flow, token refresh, and secure storage automatically. The library covers the entire Hub API surface — models, datasets, spaces, even discussions — and flags upcoming support for the Xet storage backend, which promises chunk-based deduplication for even faster downloads. For a community that’s been duct-taping together their own networking layers, this is the kind of foundational tooling that makes on-device AI experimentation feel less like a chore and more like a feature.
💡 Key Takeaways
- The new library lets Swift apps read from the standard Hugging Face cache, eliminating redundant downloads if you use both Python and Swift.
- Downloads now support progress tracking and resumption, which directly solves the common problem of large model files failing mid-transfer.
- Authentication is handled by an explicit TokenProvider system that supports Keychain, static tokens, environment variables, and a full OAuth 2.0 flow for user sign-in.
Keep reading: See related articles below for more coverage on this topic.
Get smarter about AI
The sharpest AI news, curated daily. Delivered free to your inbox.