leon is a ios library written with swift to enable developer to handle show images with animation and with more gesture
CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate Leon
into your Xcode project using CocoaPods, specify it in your Podfile
:
pod 'Leon', '~> 0.0.8'
// get point of image
let point = imageView.convert(imageView.bounds.origin, to: self.view /* view is parent view in viewController */ )
// get size of image
let size = CGSize(width: imageView.frame.width , height: imageView.frame.height)
// get frame of image
let frame = CGRect(origin: point , size: size )
There are 6 init funtions in Leon Images
// 1- first init
let vc = LeonImages(image: imageView.image!)
self.present(vc , animated: true )
- image: just pass image in imegView without starter animation
- use this init if u have image as just UIImage and don't need to load image from web
�
�
�
�
//2- second init
let vc = LeonImages(imageURL: String )
self.present(vc , animated: true )
- imageURL: is a string url of image to load from web without starter animation
- use this init if you don't want start animation
�
// 3- third init
let vc = LeonImages(listImagesURL: [Any] , index : 2 )
self.present(vc , animated: true )
- listImagesURL : an array that contain two type of images
- array may contain string url image to load from web
- array may contain UIImage to just set this image in imageView in LeonImages
- index ( optional -> default value = 0 ) : the index for starter image in array
�
// 4- fourth init
let vc = LeonImages(startFrame: imageView.frame , thumbnail: imageView.image! , imageURL: String )
self.present(vc , animated: true )
- Use this init to start Leon with animation from start fram to center of screen
- startFrame : init frame of image to start frame from this point
- thumbnail : init UIImage in imageView untile animation finished
- imageURL : start load image after animation finish
�
// 5- fifth init
let vc = LeonImages(startFrame: imageView.frame , thumbnail: imageView.image! )
self.present(vc , animated: true )
- Use this init to start Leon with animation from start fram to center of screen
- startFrame : init frame of image to start frame from this point
- thumbnail : init UIImage in imageView untile animation finished
�
// 6- Six init
let vc = LeonImages(startFrame: imageView.frame , thumbnail: imageView.image!, listImagesURL: [Any] , index : 2 )
self.present(vc , animated: true )
- startFrame : init frame of image to start frame from this point
- thumbnail : init UIImage in imageView untile animation finished
- listImagesURL : an array that contain two type of images
- array may contain string url image to load from web
- array may contain UIImage to just set this image in imageView in LeonImages
- index ( optional -> default value = 0 ) : the index for starter image in array
�
- change error message when loading failure (default value : "Error loading, tap to reload" )
let vc = // use init LeonImages
vc.errorMessage = "write your message"
- enable / disable tap to reload when loadin failure
let vc = // use init LeonImages
vc.tapToReload = true
- enable / disable close button (default value : true)
let vc = // use init LeonImages
vc.showCloseButton = false
-
dismiss image by panGesture
-
zoom image with pinch gesture
-
zoom image with double tap
-
create custom View Controller extended LeonImages
Leon
is available under the MIT license. See the LICENSE file for more info.