Skip to content
/ Viewer Public
forked from 3lvis/Viewer

Image viewer (or Lightbox) with support for local and remote videos and images

License

Notifications You must be signed in to change notification settings

freyzou/Viewer

Repository files navigation

Viewer

Table of Contents

Features

Focus

Select an image to enter into lightbox mode.

Browse

Open an image or video to browse.

Rotation

Portrait or landscape, it just works.

Zoom

Pinch-to-zoom works seamlessly in images.

tvOS

Support for the Apple TV.

Setup

You'll need a collection of items that comform to the Viewable protocol. Then, from your UICollectionView:

import Viewer

override public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
    guard let collectionView = self.collectionView else { return }

    let viewerController = ViewerController(initialIndexPath: indexPath, collectionView: collectionView)
    viewerController.dataSource = self
    presentViewController(viewerController, animated: false, completion: nil)
}

extension CollectionController: ViewerControllerDataSource {
    func viewerController(_ viewerController: ViewerController, viewableAt indexPath: IndexPath) -> Viewable {
        return photos[indexPath.row]
    }
}

Installation

Viewer is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'Viewer'

Viewer is also available through Carthage. To install it, simply add the following line to your Cartfile:

github "bakkenbaeck/Viewer"

License

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

Author

Bakken & Bæck, @bakkenbaeck

About

Image viewer (or Lightbox) with support for local and remote videos and images

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 99.5%
  • Ruby 0.5%