Skip to content

ZoomTransitioning provides a custom transition with image zooming animation and swiping the screen edge.

License

Notifications You must be signed in to change notification settings

WorldDownTown/ZoomTransitioning

Repository files navigation

ZoomTransitioning

Join the chat at https://gitter.im/WorldDownTown/ZoomTransitioning

License Swift Carthage compatible CocoaPods compatible CocoaPods Awesome

Overview

ZoomTransitioning provides a custom transition with image zooming animation. When you use this library with UINavigationController, you can pop view controller with edge swiping.

Demo

Run the demo project in the Demo directory without carthage update or pod install.

Usage

Refer to the example project for details.

import ZoomTransitioning

Adopt ZoomTransitionSourceDelegate to source view controller

extension ImageListViewController: ZoomTransitionSourceDelegate {

    func transitionSourceImageView() -> UIImageView {
        return selectedImageView
    }

    func transitionSourceImageViewFrame(forward forward: Bool) -> CGRect {
        return selectedImageView.convertRect(selectedImageView.bounds, toView: view)
    }

    func transitionSourceWillBegin() {
        selectedImageView.hidden = true
    }

    func transitionSourceDidEnd() {
        selectedImageView.hidden = false
    }

    func transitionSourceDidCancel() {
        selectedImageView.hidden = false
    }
}

Adopt ZoomTransitionDestinationDelegate to destination view controller

extension ImageDetailViewController: ZoomTransitionDestinationDelegate {

    func transitionDestinationImageViewFrame(forward forward: Bool) -> CGRect