Localframe is a simple SwiftUI image generation app for iOS 26, powered entirely by Apple’s on-device Foundation Models via Image Playground. Designed for demonstration purposes, Localframe enables fast, private, and completely offline image creation — no internet connection or server required.
Localframe showcases how to integrate Apple’s Image Playground framework into a native iOS experience using SwiftUI and the new Foundation Models tools.
- 🖼️ On-device Image Generation: Uses Apple’s local Image Playground framework.
- 🔐 Privacy-first: All prompts and generated images stay on your device. No data is sent to the cloud.
- ⚡ Fast & Offline: Images are generated locally with no need for internet access.
- 🧑🎨 Minimalist Prompt UI: Clean SwiftUI interface for crafting prompts and viewing output.
- 🗑️ No storage: Generated images are not saved after closing the app.
-
Import the Library: To work with Foundation Models, you must import the library in every file where you intend to use them. Go with:
import ImagePlayground -
Create an ImageCreator object: To start image creation, you need to create an ImageCreator object. In case of failure you will get an
ImageCreator.Error:do { try await self.imageCreator = ImageCreator() } catch { self.creatorError = error as? ImageCreator.Error }
-
Generate an Image: To create images with the model, simply call the method and pass in your text prompt (as a
String) along with the desired style (asImagePlaygroundStyle).let images = imageCreator!.images( for: [.text(self.prompt)], style: self.generationStyle, limit: 2)
-
Save Images: To display the generated images, store them in an array:
for try await image in images { if let generatedImages = generatedImages { self.generatedImages = generatedImages + [image.cgImage] } else { self.generatedImages = [image.cgImage] } }