2

I'm currently studying swift and came up with such a question:

What are best practices to work with custom user files like .pdf, .doc?

For instance, I have application, that loads different files from server like .pdf, .ppt, .zip and so on, how to present them inside my app?

While googling I came up with solutions mainly for images, but nothing particular for other file types.

For now, what I have is - downloading files from server using Alamofire and saving them to documents directory.

Could anyone please recommend how to present this files inside my app after I saved them?

Possible solution that comes to my mind is web view, but what about zip? Is there some kind of universal solution? I know that there is Files App in iOS 11, but what about iOS 10?

Many thanks for your attention!

Taras Tomchuk
  • 331
  • 7
  • 19
  • for zip file check [how-to-unzip-a-big-zip-file](https://stackoverflow.com/questions/30232207/how-to-unzip-a-big-zip-file-containing-one-file-and-get-the-progress-in-bytes-wi) may be it helps you. – Mehul Sojitra May 08 '18 at 10:59
  • I got into the same situation but in my case i didn't have to deal with .zip files. For the rest of the documents i used a WebView and it proved to the best solution so far for me and i would highly recommend. For zip files i think you have to deal differently. Either you will unzip and show the files inside or you might have to use Files App for ios 11 and give some share option for ios 10 and less so user can share. – Kamran May 08 '18 at 11:04
  • 2
    To display the doc and pdf files you can use QuickLook `QLPreviewController` – Leo Dabus May 08 '18 at 11:19
  • https://stackoverflow.com/questions/47140314/how-to-display-remote-document-using-qlpreviewcontroller-in-swift/47141577?s=2|67.8018#47141577 – Leo Dabus May 08 '18 at 11:20
  • @ Leo Dabus - thanks, that covers most of files that will be downloaded – Taras Tomchuk May 08 '18 at 11:23

0 Answers0