Swift Transformers is Hugging Face’s open-source Swift package that brings a transformers-like API to Apple platforms, so developers can download, tokenize and run transformer models natively in iOS and macOS apps.
Part of the Hugging Face ecosystem, Swift Transformers provides the Swift-side building blocks needed for on-device language-model apps: Hub integration for fetching models and tokenizer files from the Hugging Face Hub, tokenizers that behave like their Python counterparts, and utilities that pair with Core ML and MLX model packages. It is the library that powers many of Hugging Face’s own Swift demos and serves as the standard bridge between the Hub’s model catalog and Apple-native applications. Released under the Apache-2.0 license, the repository has about 1,360 stars on GitHub and is actively maintained, with its latest push in October 2026 – a good sign for a fast-moving corner of the Apple AI stack.
Its Tokenizers component implements the major tokenizer algorithms used across the Hub – BPE, WordPiece, Unigram and others – reading the same tokenizer configuration files as the Python library, so a model and tokenizer pair behaves the same way in a Swift app as it does in a Python prototype.
Swift Transformers is completely free and open source under the Apache-2.0 license. Models you download from the Hugging Face Hub follow their own licenses, but the library itself costs nothing.
Swift Transformers is for iOS and macOS developers who want to embed transformer and LLM capabilities directly in their apps, using the Hugging Face model ecosystem without sending user data to a server.