<!--
{
  "availability" : [
    "iOS: 8.0.0 - 18.0.0",
    "iPadOS: 8.0.0 - 18.0.0",
    "macCatalyst: 13.1.0 - 18.0.0",
    "macOS: 10.8.0 - 15.0.0",
    "tvOS: 10.2.0 - 18.0.0",
    "visionOS: 1.0.0 - 2.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVSampleBufferDisplayLayer/flushAndRemoveImage()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVSampleBufferDisplayLayer(im)flushAndRemoveImage"
  },
  "title" : "flushAndRemoveImage()"
}
-->

# flushAndRemoveImage()

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

```
func flushAndRemoveImage()
```

## Discussion

Apple discourages the use of this symbol in iOS 17, tvOS 17, and macOS 14 and later. Use [`flush(removingDisplayedImage:completionHandler:)`](/documentation/AVFoundation/AVSampleBufferVideoRenderer/flush(removingDisplayedImage:completionHandler:)) on the [`sampleBufferRenderer`](/documentation/AVFoundation/AVSampleBufferDisplayLayer/sampleBufferRenderer) instead.

It is not possible to determine which sample buffers have been decoded, so the next frame passed to [`enqueue(_:)`](/documentation/AVFoundation/AVSampleBufferDisplayLayer/enqueue(_:)) should be an IDR frame (also known as a key frame or sync sample).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)