<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "macCatalyst: 13.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "QuickLook",
  "identifier" : "/documentation/QuickLook/QLPreviewControllerDataSource",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Quick Look"
    ],
    "preciseIdentifier" : "c:objc(pl)QLPreviewControllerDataSource"
  },
  "title" : "QLPreviewControllerDataSource"
}
-->

# QLPreviewControllerDataSource

The protocol that a data source for a preview controller needs to adopt to provide preview items to the controller.

```
@MainActor protocol QLPreviewControllerDataSource
```

## Overview

Besides providing a [`QLPreviewController`](/documentation/QuickLook/QLPreviewController) with items to preview, this protocol is responsible for telling the preview controller how many items it needs to include in a preview item navigation list.

## Topics

### Providing data to a preview controller

[`-  numberOfPreviewItemsInPreviewController:`](/documentation/QuickLook/QLPreviewControllerDataSource/numberOfPreviewItems(in:))

Returns the number of preview items to include in the preview navigation list.

[`-  previewController:previewItemAtIndex:`](/documentation/QuickLook/QLPreviewControllerDataSource/previewController(_:previewItemAt:))

Returns the preview item that the controller displays for the specified index.



---

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)