PhotoViewerController 0.2.9

PhotoViewerController 0.2.9

Maintained by Botirjon Nasridinov.



PhotoViewerController

CI Status Version License Platform

Example

To be able to use the library, you need to first install the pod. Then import the PhotoViewerController into your project:

import PhotoViewerController

Then initliaze a PhotoViewerController object, set its delegate, initial item index. To get the desired behaviour set its modalPresentationStyle to .overFullScreen.

Example:

let photoViewer = PhotoViewerController()
photoViewer?.delegate = self
photoViewer?.initialItemIndex = 3
photoViewer?.modalPresentationStyle = .overFullScreen

You should also implement its delegate functions:

Example:

extension ViewController: PhotoViewerControllerDelegate{

    func numberOfItems(in photoViewer: PhotoViewerController) -> Int {
        // provide the number of items to display.
    }

    func numberOfActions(in photoViewer: PhotoViewerController, forItemAt index: Int) -> Int {
        // provide the number of actions for an item diplayed at index in photoViewer.
    }

    func photoViewer(_ photoViewer: PhotoViewerController, imageView: UIImageView, at index: Int) {
        // customize the imageView provided for an item to display at index in photoViewer.
    }

    func photoViewer(_ photoViewer: PhotoViewerController, topBarLeftItemsAt index: Int) -> [UIBarButtonItem] {
        // provide an array of left top bar items for the the item to display at index.
    }

    func photoViewer(_ photoViewer: PhotoViewerController, topBarRightItemsAt index: Int) -> [UIBarButtonItem] {
        // provide an array of right top bar items for the the item to display at index.
    }

    func photoViewer(_ photoViewer: PhotoViewerController, actionBarButton button: UIButton, at position: Int, forItemAt index: Int) {
        // customize the provided action button at position for an item to display at index in photoViewer.
    }

    func photoViewer(_ photoViewer: PhotoViewerController, titleForItemAt index: Int) -> String {
        // provide a title for an item to display at index in photoViewer.
    }

    func photoViewer(_ photoViewer: PhotoViewerController, captionForItemAt index: Int) -> String {
        // provide a caption text for an item to display at index in photoViewer.
    }
}

After this you are all set to present the photoViewer:

self.present(photoViewer!, animated: true, completion: nil)

Requirements

Installation

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

pod 'PhotoViewerController'

Author

Botirjon Nasridinov, [email protected]

License

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