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

# numberOfPreviewItems(in:)

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

```
func numberOfPreviewItems(in controller: QLPreviewController) -> Int
```

## Parameters

`controller`

The Quick Look preview controller that’s requesting the number of preview items.

## Return Value

The number of items that the Quick Look preview controller should include in its preview navigation list.

## Discussion

The system invokes this method to inform the preview controller of the number of preview items available.

If you push a Quick Look preview controller into view using a <doc://com.apple.documentation/documentation/UIKit/UINavigationController> object that has a toolbar, the system automatically displays arrows in the toolbar to navigate among the items in the navigation list. If you’re not displaying a toolbar and want to provide your own method of switching among items, use the [`currentPreviewItemIndex`](/documentation/QuickLook/QLPreviewController/currentPreviewItemIndex) property to indicate the item you want to display.

If you display a preview controller modally (full screen), the controller includes navigation arrows if there’s more than one item in the navigation list.

---

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)