<!--
{
  "availability" : [
    "macOS: 10.0.0 - 12.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "QuickLook",
  "identifier" : "/documentation/QuickLook/QLPreviewRequestFlushContext(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Quick Look"
    ],
    "preciseIdentifier" : "c:@F@QLPreviewRequestFlushContext"
  },
  "title" : "QLPreviewRequestFlushContext(_:_:)"
}
-->

# QLPreviewRequestFlushContext(_:_:)

Flush the context and sets the preview response.

```
func QLPreviewRequestFlushContext(_ preview: QLPreviewRequest!, _ context: CGContext!)
```

## Parameters

`preview`

The preview request object.

`context`

The graphics context to flush.

## Discussion

You should call this method immediately after drawing in the graphics contexts created by [`QLPreviewRequestCreateContext(_:_:_:_:)`](/documentation/QuickLook/QLPreviewRequestCreateContext(_:_:_:_:)) and [`QLPreviewRequestCreatePDFContext(_:_:_:_:)`](/documentation/QuickLook/QLPreviewRequestCreatePDFContext(_:_:_:_:)).

### Special Considerations

Thread-safety: This function should be called in the same thread as the preview request is made in; generally, this is the same thread in which the `GeneratePreviewForURL` callback was invoked.

---

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)