Reputation: 11
Good Day
I'm not new to swift but im new to the way swift handles file's etc... Ok ive done some extensive googling and stacking but I cant find a solution or an answer that matches my requirements.
We have a system that users can upload files on the web. The extensions are as follows:
.pdf .txt .doc .docx .bmp .jpeg .jpg .png .gif .tiff .tif .mp4 .avi .flv .mov .mwv .m4v .m4p .mpg .mpeg .mpv .3gp .xls .xlsx .xlsm .xlsb
Ok so Swift is downloading the files and saving to the local storage. I can retrieve the path once downloaded.
What I want to achieve is opening the file in the app and it must be able to do this according to the file type eg: image opens as image, video as vid ,etc
So my question is do i need to try cater for every file or is there a generic file opener that will open the file accordingly.
The file is downloaded through Alamofire's download function.
Any help would be greatly appreciated.
Upvotes: 1
Views: 794
Reputation: 3013
There couple of things is available
Look at using the Quick Look Framework - Source
A Quick Look preview controller can display previews for the following items:
WebView Supported File Formats are From Apple Documentation
In addition to HTML content, UIWebView objects can be used to display other content types, such as Keynote, PDF, and Pages documents.
From Apple Technical Q&A QA1630
Upvotes: 1