Initializes and returns a document picker that can import or open the given file types.
SDKs
- iOS 8.0+
- Mac Catalyst 13.0+
Framework
- UIKit
Declaration
init(documentTypes allowedUTIs: [String], in mode: UIDocument Picker Mode)
Parameters
allowedUTIs
An array of uniform type identifiers (UTIs). UTIs are strings that uniquely identify a file’s type. For more information, see Uniform Type Identifiers Overview.
mode
The type of file-transfer operation that the document picker performs. This argument accepts only the
UIDocument
orPicker Mode .import UIDocument
mode.Picker Mode .open
Return Value
Returns an initialized UIDocument
object, or nil
if the object could not be successfully initialized.
Discussion
In iOS 10 and earlier, this method returns the document picker view controller from the most recently used Document Provider extension. If no valid Document Provider can be found, it defaults back to iCloud Drive.
In iOS 11 and later, it returns the standard browser interface. This interface is the same one used by the UIDocument
class.