Saturday, 5 May 2018

Handsome Image Gallery with Swipe to Dismiss feature using Swift iOS.

Image Gallery (iOS Swift)

We all love image gallery in our mobile app. There could be requirement / use case also in our app that we want to show the latest feeds or social feeds in our app. There could be multiple images also to be shown on separate screen where a user can download/view the images, surf the multiple images and can download it (if required).

 Image Caching

I had used static images to show in the demo app but you can use remote url downloading and caching technique to show images. The caching is done with md5 generated string for each cached image. you can easily pass remote image url to the extension method written on UIImageView such as loadImage. This function gives you completion block after image is applied to UIImageView and cached also.

imageView.loadImage(urlString: imageURL, completion: { [weak self] (image) in
 //Your code here
})

Supported orientations - Landscape + Portrait

 This demo app supports both orientation such as Landscape, Portrait in the first collection of images screen and gallery also.

Protocol delegate oriented 

The app is has the lovely implementation on protocol, delegate pattern. You only has to pass image names array or url array.  I will soon update it with as framework, pod for easy use.

Extension written on UIViewController

 The Gallery screen is opened as UIViewController and the extension is written on UIViewController for presenting and dismissing it.


This demo app can be used by those who want to integrate this functionality in their app. The source code is open.

The github repo for the source code can be seen here

Below are the screenrecorded gif can be seen. There is fps issue in gif due to large video size. That's why the gif could be seen some jerky but if you clone the repo and run in on simulator/device then it will be smooth experience.


Portrait mode -


Landscape mode -





Thanks :)

No comments:

Post a Comment