โš ๏ธ Heads up: this tool's official website appears to be unreachable right now. It may be offline, rebranded, or temporarily down.
Swift Diffusion

Swift Diffusion

โ˜… 3.6 ๐Ÿ”– 600 saves ๐Ÿ’ฐ Free GitHub

Swift Diffusion is an open-source re-implementation of Stable Diffusion written in Swift, hosted on GitHub with about 470 stars under the BSD-3-Clause license and updates in 2026. Remarkably, the entire model lives in a single file, written to match the original implementation layer by layer.

Overview

The project includes the CLIP text tokenizer, the CLIP text encoder, the UNet diffusion model, and the decoder, together with a PLMS sampler. Because it mirrors the original Stable Diffusion computation step for step, the same starting noise produces the same image as the reference implementation. The author built it both to understand diffusion models deeply and as groundwork for running Stable Diffusion natively on iPhone and iPad, where a native Swift implementation allows mobile-specific optimizations that ONNX-style exports cannot. Working example targets cover text-to-image, image-to-image, and inpainting.

Running diffusion on a phone is a serious memory problem: the original models total roughly 8 GiB in memory at full precision. A native Swift implementation gives the developer direct control over memory layout and execution, which is exactly what mobile optimization requires, and the repository’s structure, with separate example targets for the UNet, CLIP components, encoder, and decoder, makes it a study-friendly map of the architecture.

Key Features

  • Full Stable Diffusion pipeline implemented in a single Swift file
  • CLIP tokenizer, text encoder, UNet, and decoder included
  • PLMS inference matching the original outputs layer by layer
  • Example targets for text-to-image, image-to-image, and inpainting
  • Designed as a foundation for on-device generation on iOS
  • Permissive BSD-3-Clause license

๐Ÿ’ณ Pricing

Swift Diffusion is free and open source under the BSD-3-Clause license. There are no fees or services attached; you compile it into your own Swift projects.

Who Is It For

It is aimed at Swift and iOS developers who want to run diffusion models natively on Apple devices, and at engineers who learn best from a faithful, readable re-implementation of how Stable Diffusion actually works.

๐Ÿš€ Visit Swift Diffusion Official Site

๐Ÿšฉ Report an issue