<!--
{
  "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/flush()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVSampleBufferDisplayLayer(im)flush"
  },
  "title" : "flush()"
}
-->

# flush()

Instructs the layer to discard any enqueued sample buffers that are pending.

```
func flush()
```

## Discussion

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

Because it’s not possible to determine which sample buffers have been decoded, 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)