I want to initialize an UIDocumentPickerViewController from a framework. But, the files (.pdf) are shown as grayed out in the document picker when using below code in framework. The code works fine when UIDocumentPickerViewController is initialized in the main app target. This is what I use.
let documentPicker = UIDocumentPickerViewController(forOpeningContentTypes: [.pdf])
documentPicker.delegate = self
present(documentPicker, animated: true, completion: nil)
As you are having
UIDocumentPickerViewControllerin the framework, so better way to do this is to usecustom UIViewControllerand implement all the delegates ofUIDocumentPickerViewControllerin that view controller. Then in your main app, you can inherit that custom UIViewController and call parent APIs to loadUIDocumentPickerViewController.