Skip to content

Instantly share code, notes, and snippets.

@mansi-27
Created June 7, 2018 16:04
Show Gist options
  • Select an option

  • Save mansi-27/58646e524765510e0c4c7020e8390fcb to your computer and use it in GitHub Desktop.

Select an option

Save mansi-27/58646e524765510e0c4c7020e8390fcb to your computer and use it in GitHub Desktop.
extension MyViewController: UIDocumentMenuDelegate, UIDocumentPickerDelegate {
func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentAt url: URL) {
/// Handle your document
}
func documentMenu(_ documentMenu: UIDocumentMenuViewController, didPickDocumentPicker documentPicker: UIDocumentPickerViewController) {
documentPicker.delegate = self
documentPicker.modalPresentationStyle = .overCurrentContext
present(documentPicker, animated: true, completion: nil)
}
func documentPickerWasCancelled(_ controller: UIDocumentPickerViewController) {
/// Picker was cancelled! Duh 🤷🏻‍♀️
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment