---
title: "documentBrowser(_:willPresent:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uidocumentbrowserviewcontrollerdelegate/documentbrowser(_:willpresent:)"
---

# documentBrowser(_:willPresent:)

Tells the delegate that the document browser will display an activity view.

## Declaration

```swift
optional func documentBrowser(_ controller: UIDocumentBrowserViewController, willPresent activityViewController: UIActivityViewController)
```

## Parameters

- `controller`: The current document browser.
- `activityViewController`: The activity view controller to be displayed.

## Discussion

Discussion The document browser displays an activity view when the user shares a document (for example, when the user long presses a document and then chooses Share from the Edit Menu). Implement this method to customize the activity view before it is displayed. For example, you could exclude any system-provided activities that are inappropriate for your app (see the UIActivityViewController class’s excludedActivityTypes property).

## See Also

### Working with the browser’s activity view

- [documentBrowser(_:applicationActivitiesForDocumentURLs:)](uikit/uidocumentbrowserviewcontrollerdelegate/documentbrowser(_:applicationactivitiesfordocumenturls:).md)
