How to show particular file format from iclouds derive in ios swift

萝らか妹 提交于 2019-12-13 03:47:13

问题


In my application upload the file from iclouds derive. want to upload xlsx, docx, txt.

want to upload the xlsx file means from iclouds derive want to display only xlsx another files should not display.[docx,txt]

same if the user want to display docx file means xlsx and txt ,xlsx file should not be display.

Here my code

 @IBAction func moveiclouds_BtnClick(_ sender: Any) {
        let documentPicker = UIDocumentPickerViewController(documentTypes: [kUTTypePDF as String, "com.microsoft.word.doc", "com.microsoft.excel.xls", kUTTypeCompositeContent as String, kUTTypeJPEG as String], in: .import)
        documentPicker.delegate = self
        self.present(documentPicker, animated: true, completion: nil)
    }


extension CreateFeesView: UIDocumentPickerDelegate{
    func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentAt url: URL) {
        let cico = url as URL
        cico_files = cico
        filepath_fees = url.pathExtension
    }
}

from iclouds derive all files are diplaying in recently added list. want to display only particular file in the list. how to achive help me. Thank advance


回答1:


Just adjust the documentTypes: argument when creating your document picker.

documentTypes: ["org.openxmlformats.wordprocessingml.document"]

will let the user only select docx files.

documentTypes: ["org.openxmlformats.spreadsheetml.sheet"]

will let the user only select xlsx files.



来源:https://stackoverflow.com/questions/52777175/how-to-show-particular-file-format-from-iclouds-derive-in-ios-swift

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!