Type Alias


A block that you use to receive thumbnail images generated from an asset.


typealias AVAssetImageGeneratorCompletionHandler = (CMTime, CGImage?, CMTime, AVAssetImageGenerator.Result, Error?) -> Void


Pass a block of this type to generateCGImagesAsynchronously(forTimes:completionHandler:), and use that block to receive the generated images. The generateCGImagesAsynchronously(forTimes:completionHandler:) method executes this handler once for each time value you specified.

The block takes five arguments:


The time for which you requested an image.


The image that was generated, or NULL if the image could not be generated.

This parameter follows The Get Rule.


The time at which the image was actually generated.


A result code indicating whether the image generation process succeeded, failed, or was cancelled.


If result is AVAssetImageGenerator.Result.failed, an error object that describes the problem.

See Also

Generating Images

func copyCGImage(at: CMTime, actualTime: UnsafeMutablePointer<CMTime>?) -> CGImage

Returns an image for the asset at or near a specified time.

enum AVAssetImageGenerator.Result

The statuses indicating the outcome of image generation.

func cancelAllCGImageGeneration()

Cancels all pending image generation requests.