Skip to content
This repository has been archived by the owner on Nov 24, 2021. It is now read-only.

Latest commit

 

History

History
executable file
·
112 lines (77 loc) · 2.63 KB

README.md

File metadata and controls

executable file
·
112 lines (77 loc) · 2.63 KB

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

CocoaPods

pod 'Viewer'

Carthage

github "3lvis/Viewer"

License

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