---
title: "generateRepresentations(for:update:)"
framework: quicklookthumbnailing
role: symbol
role_heading: Instance Method
path: "quicklookthumbnailing/qlthumbnailgenerator/generaterepresentations(for:update:)"
---

# generateRepresentations(for:update:)

Generates various thumbnail representations for a file and calls the update handler for each thumbnail representation.

## Declaration

```swift
func generateRepresentations(for request: QLThumbnailGenerator.Request, update updateHandler: ((QLThumbnailRepresentation?, QLThumbnailRepresentation.RepresentationType, (any Error)?) -> Void)? = nil)
```

## Parameters

- `request`: The request that contains information about the thumbnail that you want to create.
- `updateHandler`: The handler to call successively for each requested representation of a thumbnail. QuickLookThumbnailing calls the updateHandler in order of lower quality to higher quality thumbnail types. If a better quality thumbnail becomes available before a lower quality one, the framework may skip the call to the updateHandler for the lower quality thumbnail. You can rely on QuickLookThumbnailing to call the updateHandler at least once by the time it finishes the creation of thumbnails with either the best requested thumbnail, or an error object. The handler takes the following parameters:

## Mentioned in

Creating Quick Look Thumbnails to Preview Files in Your App

## Discussion

Discussion Use this method if you want to create a file icon or low-quality thumbnail quickly, and replace it with a higher quality thumbnail once it becomes available.

## See Also

### Generating a Thumbnail

- [generateBestRepresentation(for:completion:)](quicklookthumbnailing/qlthumbnailgenerator/generatebestrepresentation(for:completion:).md)
- [QLThumbnailGenerator.Request](quicklookthumbnailing/qlthumbnailgenerator/request.md)
