---
title: "init(documentTypes:in:)"
framework: uikit
role: symbol
role_heading: Initializer
path: "uikit/uidocumentmenuviewcontroller/init(documenttypes:in:)"
---

# init(documentTypes:in:)

Initializes and returns a document menu to import or open the given file types.

## Declaration

```swift
init(documentTypes allowedUTIs: [String], in mode: UIDocumentPickerMode)
```

## Parameters

- `allowedUTIs`: An array of uniform type identifiers. UTIs are strings that uniquely identify a file’s type. For more information, see https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_intro/understand_utis_intro.html#//apple_ref/doc/uid/TP40001319.
- `mode`: The type of file transfer operation the document picker performs. This argument accepts only the doc://com.apple.uikit/documentation/UIKit/UIDocumentPickerMode/import or doc://com.apple.uikit/documentation/UIKit/UIDocumentPickerMode/open mode.

## Return Value

Return Value Returns an initialized UIDocumentMenuViewController object, or nil if the object could not be successfully initialized.

## Discussion

Discussion The UTI array defines the type of documents that can be imported or opened. The resulting document menu displays all the document pickers appropriate for the given document types and mode.

## See Also

### Creating a document menu

- [init(url:in:)](uikit/uidocumentmenuviewcontroller/init(url:in:).md)
- [init(coder:)](uikit/uidocumentmenuviewcontroller/init(coder:).md)
