Search code examples
iosswiftuidocumentpickerviewcontroller

Swift UIDocumentPickerViewController not showing like Action sheet popup


I am trying to access third party cloud applications. my app upload button click to open UIDocumentPickerViewController and need to pick files (single or multiple) then I am uploading my server.

  1. Upload button click to UIDocumentPickerViewController opening fullscreen not opening like action sheet.

  2. Need to access all type of files.

Here below my code

let importMenu = UIDocumentPickerViewController(documentTypes: ["public.text", "com.apple.iwork.pages.pages", "public.data"], in: .import)
importMenu.delegate = self
importMenu.modalPresentationStyle = .formSheet            
if let popoverPresentationController = importMenu.popoverPresentationController {
    popoverPresentationController.sourceView = self.view;
    //popoverPresentationController.sourceView = sender as? UIView
    //popoverPresentationController.sourceRect = sender.bounds
}
self.present(importMenu, animated: true, completion: nil)  

Solution

  • Check documentation your answer is in below image. enter image description here