ZoomTransitioning


Introduction

Welcome to the documentation for ZoomTransitioning! This document provides detailed information on how to use ZoomTransitioning in your iOS app development. ZoomTransitioning is a custom transition library for smooth and interactive zoom transitions between view controllers.


Installation

To integrate ZoomTransitioning into your Xcode project, you can use CocoaPods or manually include the library files.

CocoaPods:

  • Add the following line to your Podfile:

  • // Podfile

    pod 'ZoomTransitioning'
  • Run the command pod install in Terminal.
  • Open your project using the newly created .xcworkspace file.

Manual installation:

  • Download the latest version of ZoomTransitioning from the GitHub repository.
  • Drag and drop the necessary source files into your Xcode project.


Usage

To use ZoomTransitioning, follow the steps below:

  1. Import the required module in your view controller file:

  2. // Swift

    import ZoomTransitioning

    // Objective-C

    @import ZoomTransitioning;
  3. Implement the ZoomTransitionSourceDelegate protocol on your view controller:

  4. // Swift

    class ViewController: UIViewController, ZoomTransitionSourceDelegate {

    // Objective-C

    @interface ViewController : UIViewController 
  5. Implement the required delegate methods to provide the views and frames for the zoom transition:

  6. // Swift

    func transitionZoomView() -> UIView {
        // Return the view you want to zoom
    }
        
    func transitionSourceImageViewFrame(forward: Bool) -> CGRect {
        // Return the initial frame of the source image view
    }

    // Objective-C

    - (UIView *)transitionZoomView {
        // Return the view you want to zoom
    }
        
    - (CGRect)transitionSourceImageViewFrameForForward:(BOOL)forward {
        // Return the initial frame of the source image view
    }
  7. Prepare the destination view controller by setting its transitioningDelegate and modalPresentationStyle:

  8. // Swift

    let destinationVC = DestinationViewController()
    destinationVC.transitioningDelegate = ZoomTransitioningDelegate.shared
    destinationVC.modalPresentationStyle = .fullScreen
    present(destinationVC, animated: true, completion: nil)

    // Objective-C

    DestinationViewController *destinationVC = [[DestinationViewController alloc] init];
    destinationVC.transitioningDelegate = [ZoomTransitioningDelegate sharedDelegate];
    destinationVC.modalPresentationStyle = UIModalPresentationFullScreen;
    [self presentViewController:destinationVC animated:YES completion:nil];


Additional Configuration

ZoomTransitioning provides additional configuration options to customize the transition behavior:

  • animationDuration: Specifies the duration of the transition animation.
  • zoomScale: Specifies the scale factor applied to the zoomed view.
  • dampingRatio: Specifies the damping ratio for the animation.
  • springVelocity: Specifies the initial spring velocity for the animation.

You can modify these options by accessing the ZoomTransitioningDelegate.shared instance and setting the desired values.


Conclusion

Congratulations! You have successfully integrated and used ZoomTransitioning in your iOS app. Enjoy the smooth and interactive zoom transitions between view controllers. For more information, refer to the official GitHub repository here.