2

I wish to have a DocumentBrowser in my app, in the Apple Docs it is stated that the UIDocumentBrowser must be the rootWindow of my APP, so I should use UIDocumentPicker instead, but I realised that if a delegate method is called on UIDocumentPicker the ViewController is dismissed which is not needed in my use-case. Can I disable, or workaround this functionality?

I have tried to override the dismissal of the UIDocumentPicker but it is net even called when the user takes an action on document.

final class MyDocumentPicker : UIDocumentPickerViewController {
    override func dismiss(animated flag: Bool, completion: (() -> Void)? = nil) {
        super.dismiss(animated: true, completion: completion)
    }
}

https://developer.apple.com/documentation/uikit/view_controllers/adding_a_document_browser_to_your_app

Important

Always assign the document browser as your app's root view controller. >>Don't place the document browser in a navigation controller, tab bar, or >>split view, and don't present the document browser modally.

If you want to present a document browser from another location in your >>view hierarchy, use a UIDocumentPickerViewController instead.

However I did try to present it as modal and it worked, but I fear that the app would be rejected, when release cames, or I will face issues in some use-cases which are not discovered/covered yet.

0 Answers0