/Viewer

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

Primary LanguageSwiftOtherNOASSERTION

Viewer

Version Carthage compatible platforms License

Demo

Focus

Select an image to enter 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.

Setup

From your UICollectionView:

override func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
    guard let collectionView = self.collectionView else { return }

    let viewerController = ViewerController(initialIndexPath: indexPath, collectionView: collectionView)
    let headerView = HeaderView()
    headerView.viewDelegate = self
    self.viewerController?.headerView = headerView
    let footerView = FooterView()
    footerView.viewDelegate = self
    self.viewerController?.footerView = footerView
    viewerController.controllerDataSource = self
    self.presentViewController(viewerController, animated: false, completion: nil)
}

extension CollectionController: ViewerControllerDataSource {
    func viewerController(viewerController: ViewerController, itemAtIndexPath indexPath: NSIndexPath) -> ViewerItem {
        return self.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