<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.1.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIDocumentBrowserViewControllerDelegate/documentBrowser(_:willPresent:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UIDocumentBrowserViewControllerDelegate(im)documentBrowser:willPresentActivityViewController:"
  },
  "title" : "documentBrowser(_:willPresent:)"
}
-->

# documentBrowser(_:willPresent:)

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

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

## Parameters

`controller`

The current document browser.

`activityViewController`

The activity view controller to be displayed.

## 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`](/documentation/UIKit/UIActivityViewController) class’s [`excludedActivityTypes`](/documentation/UIKit/UIActivityViewController/excludedActivityTypes) property).

---

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)