Last active
May 29, 2020 16:06
-
-
Save Yorzic/df175faa63d4337263f7419aadc76b25 to your computer and use it in GitHub Desktop.
Adhering to UIDocumentPickerViewController
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) { | |
guard let myURL = urls.first else { | |
return | |
} | |
print("import result : \(myURL)") | |
} | |
func documentPickerWasCancelled(_ controller: UIDocumentPickerViewController) { | |
print("view was cancelled") | |
dismiss(animated: true, completion: nil) | |
} | |
func selectFile() { | |
let importMenu = UIDocumentPickerViewController(documentTypes: [(kUTTypeCommaSeparatedText as String)], in: .import) | |
importMenu.delegate = self | |
importMenu.modalPresentationStyle = .formSheet | |
self.present(importMenu, animated: true, completion: nil) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment