Giter Site home page Giter Site logo

leon's Introduction

Leon

leon is a ios library written with swift to enable developer to handle show images with animation and with more gesture

Installation

CocoaPods

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'

Usage

How to get image frame

if container of image is UIView or UIStackView

// 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

First init

// 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







Second init

//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




Third init

// 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




Fourth init

// 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




Fifth init

// 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




Sixth init

// 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




Features

  • 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

    Example of CustomLeonImages

    Custom Leon Images

Author

Yusef Naser

License

Leon is available under the MIT license. See the LICENSE file for more info.

leon's People

Contributors

yusef-naser avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.