ios – How to programmatically open Share Activity within UIDocumentPickerViewController after presenting

0
20

[ad_1]

Manually you can long press and show actions and select Share Acitivity that opens within the document picker view.

Is it possible to automate this process by code?

Press a button -> automatically open file directory -> automatically open share activity of that file.

    let picker = UIDocumentPickerViewController(
      forOpeningContentTypes: [
         UTType.mpeg4Audio,
      ],
      asCopy: true)
    
    picker.delegate = self
    picker.directoryURL = fileDirectory
    self.present(picker, animated: true, completion: nil)

    // Now, after presenting
    // I want to automatically open Share Activity of that file

[ad_2]