         let (fromViewController, toViewController) = configure(using: transitionContext)
         
         UIView.animate(withDuration: duration, delay: 0, options: options.option, animations: {
-            switch self.direction {
-            case .top:
-                fromViewController.top()
-            case .left:
-                fromViewController.left()
-            case .bottom:
-                fromViewController.bottom()
-            case .right:
-                fromViewController.right()
-            }
+            fromViewController.updateFrame(with: self.direction)
             toViewController.center()
         }) { _ in
             transitionContext.completeTransition(true)


fileprivate extension UIViewController {
    
    func center() {
        view.frame.origin = .zero
    }
    
    func top() {
        view.frame.origin.y -= view.frame.size.height
    }
    
    func left() {
        view.frame.origin.x -= view.frame.size.width
    }
    
    func bottom() {
        view.frame.origin.y += view.frame.size.height
    }
    
    func right() {
        view.frame.origin.x += view.frame.size.width
    }
}

    private func show(using transitionContext: UIViewControllerContextTransitioning) {
        let (fromViewController, toViewController) = configure(using: transitionContext)
        
        toViewController.updateFrame(with: direction)
        
        UIView.animate(withDuration: duration, delay: 0, options: options.option, animations: {
            fromViewController.updateFrame(with: self.direction, reverse: true)
            toViewController.center()
        }) { _ in
            transitionContext.completeTransition(true)
