1

I would like to hide the files that do not match the document types passed to the UIDocumentPickerViewController, i.e only show those that match.
For example, if the document type is "public.movie", I want only video files and folders to be shown in the picker.

Vinh Hung Nguyen
  • 139
  • 1
  • 11
  • Please share your code. – Rajan Apr 15 '20 at 04:54
  • Does this answer your question? [Need to allow ppt files to be selected by UIDocumentPicker](https://stackoverflow.com/questions/61118397/need-to-allow-ppt-files-to-be-selected-by-uidocumentpicker) – Mohit Kumar Apr 15 '20 at 05:18
  • @MohitKumar Thanks for your help, but that's not what I mean. What I want is that any files which are not video files will not be shown in the picker. – Vinh Hung Nguyen Apr 15 '20 at 05:43

1 Answers1

-1

Please try below code:

let types: [String] = ["public.movie", "public.video"]
let documentPicker = UIDocumentPickerViewController(documentTypes: types, in: .import)
documentPicker.delegate = self
documentPicker.modalPresentationStyle = .formSheet
self.present(documentPicker, animated: true, completion: nil)

you can add/remove any value from types as per your need:

let types: [String] = ["public.movie", "public.video"]

Please comment if you have any problem with the code.

Happy to Help!

Mohit Kumar
  • 2,898
  • 3
  • 21
  • 34