Giter Club home page Giter Club logo

imageviewer's Introduction

ImageViewer

Swift 2.1 Platforms iOS License MIT

ImageViewer is a library that enables a user to visualize an image in fullscreen. Besides the typical pinch and double tap to zoom, we also provide a vertical swipe to dismiss. Finally, we try to mimic the displacement of the image from its current container into fullscreen, this feature being its main selling point. In our context, you can imagine an image as part of an article and when it's tapped, the image is animated into fullscreen.

Setup

Cocoapods:

# source 'https://github.com/CocoaPods/Specs.git'
# use_frameworks!
# platform :ios, "8.0"

pod "ImageViewer"

Carthage:

github "MailOnline/ImageViewer"

Usage

let imageProvider: ImageProvider = ... 

let buttonConfiguration = ButtonStateAssets(normalImage:UIImage(named: "normalImage"), highlightedImage:UIImage(named: "highlightedImage"))
let configuration = ImageViewerConfiguration(imageSize: size, closeButtonAssets: buttonConfiguration)

let imageViewer = ImageViewer(imageProvider: imageProvider, configuration: configuration, displacedView: displacedView)

viewController.presentImageViewer(imageViewer)
  • imageProvier: An object that is able to provide an image via a callback UIImage? -> Void.
  • configuration: Contains information about the assets that will be used for the close button and the image to be displayed's size.
  • displacedView: The view that is about to be displayed in fullscreen.

Roadmap

  • Setup Travis
  • Clean up internal logic (refactoring mostly)
  • Remove the XIB file and create the UI with code
  • Use UITraitCollection for rotation. traitCollectionDidChange is not called if only Portrait is enabled at a project configuration level
  • Investigation
  • Investigate the usage of custom transitions
  • Investigate a more idiomatic way of dealing with the orientation changes
  • Change anchor points to improve rotations animation paths
  • UI Testing
  • Expand the ImageViewer to a Gallery
  • Consider UIVisualEffectView for the Close button as default option

Caveats

Because ImageViewer was created with a given configuration in mind, it might be limiting factor for certain apps:

  • Currently the library will only behave correctly in apps that have rotation disabled (only Portrait). Since we are applying transformations and listening for UIDeviceOrientationDidChangeNotification. We have a couple of ideas on how to solve this problem and provide a more predictable behaviour. Given all this, you shouldn't use for an iPad app.
  • ImageViewer is currently a UIViewController subclass, we are considering making it a UIView, as we find the later lifecycle more reliable. We are adding ImageViewer's root view to the UIWindow's subViews and itself as a childViewController of the window.rootViewController. We are still looking into a way of making this part a bit more idiomatic, while maintaining the great fullscreen look.
  • We are seeing some issues with the animations due to different aspect ratio between the displacedView and the fullscreen UIImageView. We aren't sure if it's worth to fix this, as we don't run into this problem.

License

ImageViewer is licensed under the MIT License, Version 2.0. View the license file

Copyright (c) 2015 MailOnline

imageviewer's People

Contributors

krisiacik avatar mluisbrown avatar ruiaaperes avatar

Watchers

 avatar  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.