Open a specific folder using UIDocumentPickerViewController

I'm using UIDocumentPickerViewController to import document to my app from OneDrive and I want to show the OneDrive folder every time I use UIDocumentPickerViewController instead of the last folder I opened. Is it possible? Can I use pickerController.directoryURL ? And how to get folder URL of OneDrive?

class ViewController: UIViewController, DocumentDelegate {
  var picker: DocumentPicker?
   
  override func viewDidLoad() {
    super.viewDidLoad()
    picker = DocumentPicker(presentationController: self, delegate: self)
  }


  @IBAction func create_picker(_ sender: Any) {
    picker?.presentDocumentPicker()
  }
   
  func didPickImage(image: UIImage?) {}
}


protocol DocumentDelegate: AnyObject {
  func didPickImage(image: UIImage?)
}

class DocumentPicker: NSObject {
  private var pickerController: UIDocumentPickerViewController?
  private weak var presentationController: UIViewController?
  private weak var delegate: DocumentDelegate?

  init(presentationController: UIViewController,
     delegate: DocumentDelegate) {
    super.init()
    self.presentationController = presentationController
    self.delegate = delegate
  }
   
  func presentDocumentPicker() {
    pickerController = UIDocumentPickerViewController(forOpeningContentTypes: [.image])
    if let pickerController = pickerController {
      pickerController.delegate = self
      pickerController.allowsMultipleSelection = false
      presentationController?.present(pickerController, animated: true)
    }
  }
}

extension DocumentPicker: UIDocumentPickerDelegate {
  func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) {
    guard let url = urls.first else { return }
    print(url)
  }
}

làm cách nào để bạn chỉnh nó thành màu đen thế

Did you ever figure this out? I have the same issue.

Open a specific folder using UIDocumentPickerViewController
 
 
Q