---
title: "imagePlaygroundSheet(isPresented:concept:sourceImageURL:onCompletion:onAdaptiveImageGlyphCreation:onCancellation:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/imageplaygroundsheet(ispresented:concept:sourceimageurl:oncompletion:onadaptiveimageglyphcreation:oncancellation:)"
---

# imagePlaygroundSheet(isPresented:concept:sourceImageURL:onCompletion:onAdaptiveImageGlyphCreation:onCancellation:)

Presents the system sheet to create an image or Genmoji using the specified string and image URL.

## Declaration

```swift
@MainActor @preconcurrency func imagePlaygroundSheet(isPresented: Binding<Bool>, concept: String, sourceImageURL: URL, onCompletion: @escaping (URL) -> Void, onAdaptiveImageGlyphCreation: @escaping (NSAdaptiveImageGlyph) -> Void, onCancellation: (() -> Void)? = nil) -> some View

```

## Parameters

- `isPresented`: A binding to a variable with a Boolean value. Set the Boolean value to true to display the sheet, and set it to false to dismiss the sheet.
- `concept`: A natural language string that describes the expected contents of the image. Inside the creation UI, the person can replace this value with a different description for the image.
- `sourceImageURL`: A file URL that refers to the image to use as source input for the new image. The person viewing the sheet can override the image you provide, and choose different images and concepts inside the creation UI. If you don’t provide a starting image, the system creates the new image using only the contents of the concepts parameter.
- `onCompletion`: The block to receive the created image. The block has no return value and receives the following parameter:
- `onAdaptiveImageGlyphCreation`: The block to receive the generated Genmoji. The block has no return value and receives the following parameter: imageGlyph: An doc://com.apple.documentation/documentation/UIKit/NSAdaptiveImageGlyph with the generated Genmoji. After executing this block, the system automatically dismisses the sheet.
- `onCancellation`: The block to execute when the person exits. the creation UI without choosing an image. After executing this block, the system automatically dismisses the sheet.

## Discussion

Discussion Use this modifier to display the image-creation sheet from one of your SwiftUI views. The sheet presents a system-provided UI to generate an image or Genmoji from a text-based description and optional image. The sheet gives the person controls to modify the image before returning it to your app. When the person dismisses the sheet, the system runs one of the blocks you provided. Use the completion or adaptive glyph block to integrate the generated image into your app’s content. This modifier works only on devices that support the creation of new images. Check the ImagePlayground/SwiftUICore/EnvironmentValues/supportsImagePlayground environment variable to determine the availability of the feature. The following code creates a button to display the sheet only when the feature is available: @State private var showSheet = false @State private var createdImageURL: URL? = nil @State private var createdImageGlyph: NSAdaptiveImageGlyph? = nil @Environment(\.supportsImagePlayground) private var supportsImagePlayground // ....

if supportsImagePlayground {   Button("Show Generation Sheet") {     showSheet = true   }.imagePlaygroundSheet(     isPresented: $showSheet,     concept: "Dog on a surfboard",     sourceImageURL: sourceImageURL,     onCompletion: { url in       createdImageURL = url     }, onAdaptiveImageGlyphCreation: { imageGlyph in       createdImageGlyph = imageGlyph     })   } }

## See Also

### Generating images

- [imagePlaygroundGenerationStyle(_:in:)](swiftui/view/imageplaygroundgenerationstyle(_:in:).md)
- [imagePlaygroundOptions(_:)](swiftui/view/imageplaygroundoptions(_:).md)
- [imagePlaygroundSheet(isPresented:concept:sourceImage:onCompletion:onCancellation:)](swiftui/view/imageplaygroundsheet(ispresented:concept:sourceimage:oncompletion:oncancellation:).md)
- [imagePlaygroundSheet(isPresented:concept:sourceImage:onCompletion:onAdaptiveImageGlyphCreation:onCancellation:)](swiftui/view/imageplaygroundsheet(ispresented:concept:sourceimage:oncompletion:onadaptiveimageglyphcreation:oncancellation:).md)
- [imagePlaygroundSheet(isPresented:concept:sourceImageURL:onCompletion:onCancellation:)](swiftui/view/imageplaygroundsheet(ispresented:concept:sourceimageurl:oncompletion:oncancellation:).md)
- [imagePlaygroundSheet(isPresented:concepts:sourceImage:onCompletion:onCancellation:)](swiftui/view/imageplaygroundsheet(ispresented:concepts:sourceimage:oncompletion:oncancellation:).md)
- [imagePlaygroundSheet(isPresented:concepts:sourceImage:onCompletion:onAdaptiveImageGlyphCreation:onCancellation:)](swiftui/view/imageplaygroundsheet(ispresented:concepts:sourceimage:oncompletion:onadaptiveimageglyphcreation:oncancellation:).md)
- [imagePlaygroundSheet(isPresented:concepts:sourceImageURL:onCompletion:onCancellation:)](swiftui/view/imageplaygroundsheet(ispresented:concepts:sourceimageurl:oncompletion:oncancellation:).md)
- [imagePlaygroundSheet(isPresented:concepts:sourceImageURL:onCompletion:onAdaptiveImageGlyphCreation:onCancellation:)](swiftui/view/imageplaygroundsheet(ispresented:concepts:sourceimageurl:oncompletion:onadaptiveimageglyphcreation:oncancellation:).md)
