All projects

Implementation reference · iOS 26 · Image Playground

Localframe

Localframe is a SwiftUI showcase for Apple’s Image Playground framework, not a production-ready app. It demonstrates how a native image generation flow is implemented with the iOS 26 SDK.

Problem

Image generation without the system sheet

The Image Playground sheet provides Apple’s complete creation interface. Localframe instead demonstrates the iOS 26 ImageCreator API, where an app owns the prompt, style picker, progress state, and result presentation while Apple’s model performs generation on the device.

Implementation scope

From text concept to asynchronous image results

The app implements asynchronous ImageCreator initialization, prompt and style input, a dedicated generation state, final result display, initialization errors, and reset behavior after successful generation. Generated images are stored in SwiftUI state and are not persisted. ImageCreator is discontinued for iOS 27 and later, so the implementation targets iOS 26.

Generation flow

One request, up to two results

The initial screen exposes a segmented style picker and a prompt field. Submitting the prompt replaces that screen with two progress indicators. The view model collects each result from the asynchronous sequence, but the interface remains on the progress screen until generation finishes. It then displays the available images vertically and offers a restart action that clears the current workflow.

Prompt and style

A short text concept with animation, illustration, or sketch.

ImageCreator

ImageCreator returns results through an asynchronous sequence.

Up to two results

Each CGImage is collected before the final view appears.

The implemented generation flow. Localframe keeps the resulting images in memory and does not persist them.

The essential loop

Generate and collect images

ImageCreator returns an asynchronous sequence. The view model collects each result in SwiftUI state and presents the final view after the sequence finishes.

swift
let images = imageCreator.images(
    for: [.text(inputPrompt)],
    style: selectedStyle,
    limit: 2
)

for try await image in images {
    generatedCGImages.append(image.cgImage)
}

Implementation notes

A small state-driven SwiftUI reference

The implementation imports ImagePlayground and creates ImageCreator asynchronously. If setup fails, the framework error is stored for display in the UI.

A prompt is converted into a .text concept and passed to images(for:style:limit:). The returned asynchronous sequence produces results one at a time.

Each result’s CGImage is appended to SwiftUI state while the progress view remains visible. After the sequence finishes, the final view displays the collected images. There is no database, cloud service, or persistence layer.

ImageCreator was discontinued for iOS 27 and later. Apple recommends the Image Playground sheet managed by the system or another service for image generation on newer systems.

Platform boundary

An iOS 26 reference only

Apple discontinued ImageCreator for iOS 27 and later. Localframe therefore documents the original on-device API rather than providing a compatibility layer for newer systems. Apple recommends the system-managed Image Playground sheet or another image generation service for new implementations. An initialization or generation failure replaces the current flow with an error view; the implemented interface does not offer a retry action from that state.

  • iOS 26 and Xcode 26
  • A real iPhone compatible with Apple Intelligence
  • Apple Intelligence enabled
  • A supported device and Siri language
  • The iOS Simulator is not supported