---
title: "getPagesWithCompletionHandler(_:)"
framework: safariservices
role: symbol
role_heading: Instance Method
path: "safariservices/sfsafaritab/getpageswithcompletionhandler(_:)"
---

# getPagesWithCompletionHandler(_:)

Calls the completion handler with all of the tab’s active and preloading pages.

## Declaration

```swift
func getPagesWithCompletionHandler(_ completionHandler: @escaping @Sendable ([SFSafariPage]?) -> Void)
```

```swift
func pages() async -> [SFSafariPage]?
```

## Parameters

- `completionHandler`: A block to call when the tab’s pages are retrieved.

## Discussion

Discussion important: You can call this method from synchronous code using a completion handler, as shown on this page, or you can call it as an asynchronous method that has the following declaration: func pages() async -> [SFSafariPage]? For information about concurrency and asynchronous code in Swift, see Calling Objective-C APIs Asynchronously. The tab’s pages include the active page and other pages that Safari might be loading in the background; for example, Top Hits.

## See Also

### Accessing Pages

- [getActivePage(completionHandler:)](safariservices/sfsafaritab/getactivepage(completionhandler:).md)
