Apple Intelligence ImagePlayground
ImagePlayground is an AI based image generation tool powered by Apple Intelligence.
To use ImagePlayground in SwiftUI a system sheet can be opened using the view modifier `.imagePlaygroundSheet(isPresented:,concept:,onCompletion:...)`. The feature is available since iOS 18.1.
ImagePlayground is not available in a Simulator, but can be tested on a mac with M1 or later when the app is run as a "Mac Catalyst" app. Note that Apple Intelligence is required for that and that is not available in all regions.
import SwiftUI import ImagePlayground import PencilKit struct ImagePlaygroundView: View { @State var showPlayground: Bool = false @State var concept: String = "" var body: some View { if #available(iOS 18.1, *) { VStack(spacing: 20) { Text("Image Playground") .font(.largeTitle) Button(action: { showPlayground.toggle() }, label: { Text("Show") }) } .imagePlaygroundSheet( isPresented: $showPlayground, concept: concept, onCompletion: { url in print("url = \(url)") }) .navigationTitle("Image Playground") } else { Text("Need iOS 18.1") .navigationTitle("Image Playground") } } }
