About ZFDragableModalTransition

ZFDragableModalTransition is a custom modal transition animation for presenting view controllers.


  • Interactive transitions with draggable modal view
  • Customize modal view background color, corner radius, and shadow
  • Support for both direction-based transition and custom transform-based transition
  • Handle gestures and animate dismiss when dragging or swiping
  • Control the animation duration and spring damping


You can install ZFDragableModalTransition via Cocoapods by adding the following line to your Podfile:

pod 'ZFDragableModalTransition'


To use ZFDragableModalTransition, follow the steps below:

  • Import ZFDragableModalTransition module.
  • Set the modalPresentationStyle of the view controller to custom before presenting it.
  • Assign an instance of ZFDragableModalTransition as the view controller’s transitioningDelegate.
  • Adjust the properties of the ZFDragableModalTransition instance according to your needs.
  • Call present(_:animated:completion:) method to present the view controller.


import ZFDragableModalTransition

class ViewController: UIViewController {

    let transition = ZFDragableModalTransition()

    override func viewDidLoad() {
        // Set the modalPresentationStyle
        modalPresentationStyle = .custom
        // Assign the transitioningDelegate
        transitioningDelegate = transition

    @IBAction func presentModalViewController() {
        let modalViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "ModalViewController")
        // Customize the modal view properties
        // transition.modalBackgroundColor = UIColor.white
        // transition.modalCornerRadius = 4.0
        // transition.modalShadowOpacity = 0.5
        // transition.modalShadowRadius = 6.0
        present(modalViewController, animated: true, completion: nil)


You can customize the appearance and behavior of the modal view using the following properties:

  1. modalBackgroundColor: The background color of the modal view.
  2. modalCornerRadius: The corner radius of the modal view.
  3. modalShadowOpacity: The opacity of the shadow for the modal view.
  4. modalShadowRadius: The radius of the shadow for the modal view.
  5. direction: The direction of the draggable modal view.
  6. dragableBorderMargin: The margin of the draggable border area.
  7. animationDuration: The duration of the animation.
  8. animationDamping: The damping value for the animation.


ZFDragableModalTransition provides a flexible and interactive transition animation for presenting view controllers. It allows you to customize various properties to achieve the desired visual and behavioral effects. With its easy-to-use interface, you can quickly integrate this library into your projects and create a smoother and more engaging user experience.