---
title: flushAndRemoveImage()
framework: avfoundation
role: symbol
role_heading: Instance Method
path: avfoundation/avsamplebufferdisplaylayer/flushandremoveimage()
---

# flushAndRemoveImage()

Instructs the layer to discard pending enqueued sample buffers and remove any currently displayed image.

## Declaration

```swift
func flushAndRemoveImage()
```

## Discussion

Discussion Apple discourages the use of this symbol in iOS 17, tvOS 17, and macOS 14 and later. Use flush(removingDisplayedImage:completionHandler:) on the sampleBufferRenderer instead. It is not possible to determine which sample buffers have been decoded, so the next frame passed to enqueue(_:) should be an IDR frame (also known as a key frame or sync sample).

## See Also

### Flushing sample buffers

- [flush()](avfoundation/avsamplebufferdisplaylayer/flush().md)
