Skip to content

lokae0/PocketDiffusion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pocket Diffusion

This is a sample project that uses Stable Diffusion 1.5 to generate AI images locally on an iOS device. The app can be run fully offline and generated images are persisted.

Demos:

Editing settings, image generation, and cancellation List editing, zoomable image view, copy settings

To run this project:

Topics covered:

  • Using Apple's ml-stable-diffusion library to run local SD models with CoreML
    • The SD 1.5 variant specified above is quantized to fit within the lower RAM limits of a typical iOS device
    • SPLIT_EINSUM_V2 allows the Apple Neural Engine to be used alongside CPU for faster generations
    • Although this model is outdated by 2026 standards, it suits this project well due to its ease of use, small size and fast speed. Plus, the hallucinations and artifacts are already becoming fun throwbacks! 😉
  • Concurrency
    • Actor isolation and background threads for long running tasks (loading models, generating images, persistence, etc.)
    • Propagating Task cancellation across isolation boundaries, AsyncStream, and third party library tasks
    • Enabled strict concurrency for data race safety
    • Adapting to Swift 6.2's Approachable Concurrency default main actor isolation
  • Basic persistence with FileManager and UserDefaults
    • Alternatives like GRDB, sqlite-data, and SwiftData were considered but deemed overkill for the scope of this app
  • SwiftUI with Apple's Liquid Glass design
  • String Catalogs (xcstrings) for localization
  • Swift Testing
  • Icon Composer

License:

  • MIT. See the LICENSE file for details.

Acknowledgments:

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages