Writing virtual file and folder browser on iOS
Last week while working on one of my personal projects, I got an idea of creating local file system where users can create folder and store image files.
I am saying it because my app mainly deals with image types. If you want, you can try saving PDF, movies and other types too
So initial UI looks like this,
The folders arranged using
UICollectionView and each folder/file is custom
UICollectionViewCell. I am using two custom
cell subclasses as for images I need to show thumbnail while for folder there is a static front image.
- You can add new folder by clicking on
+button on top right nav bar. Provide a name and it will create a folder. If it finds folder/file with same name, it will fail (And of course you'll have to choose another unique name)
You can even create subfolders. While passing between folder, I am simply passing last component of folder path which gets appended to create child folder hierarchy.
Did I tell you that you that for each folder you can actually view the number of folders inside it.
Folder can contain subfolders as well as image files.
If you want to load an image, simply click on it and it loads the image through provided block. User can then use the image the it wants.
- If you want to save an image, simply browse to desired folder and then click save button at the top
Similarly, if there is too clutter of files, you can simply erase undesired file and folder using top
Trash Icon. Once pressed, you may select files need to be cleaned up and then click the
Done button on the top left nav bar. Selected files will be removed.
The work on file browser is still in progress. I can update it as I can find more and more bug and issues. Besides there are few more ambitious functionalities I am planning to add such as renaming and moving folder/files from one location to another with/without copy/paste or cut/paste ability
Hope you liked this post. If you have any suggestion on how to improve it or have some ideas how new feature can be added or can be made more useful, let me know!