                 break
             }
             
-            addChildViewController(toViewController)
-            fromViewController.willMove(toParentViewController: nil)
+            addChild(toViewController)
+            fromViewController.willMove(toParent: nil)
             let completion: (() -> Void) = {() -> Void in
                 fromViewController.view.removeFromSuperview()
-                fromViewController.removeFromParentViewController()
-                toViewController.didMove(toParentViewController: self)
+                fromViewController.removeFromParent()
+                toViewController.didMove(toParent: self)
                 self.delegate?.revealController?(self, didAdd: toViewController, for: operation, animated: animated)
             }
             var customBlock: (() -> Void)?

            self.panGestureRecognizer = PBRevealViewControllerPanGestureRecognizer(target: self, action: #selector(self._handlePanGesture(_:)))
            self.panGestureRecognizer?.delegate = self
            self.contentView?.addGestureRecognizer(self.panGestureRecognizer!)
            self.leftViewController?.willMove(toParentViewController: nil)
            self.leftViewController?.removeFromParentViewController()
            self.rightViewController?.willMove(toParentViewController: nil)
            self.rightViewController?.removeFromParentViewController()
        }
//#endif
        return self.panGestureRecognizer!

        
        let completion: (() -> Void) = {() -> Void in
            fromViewController.view.removeFromSuperview()
            fromViewController.removeFromParent()
            toViewController.didMove(toParent: self)
            if operation == .pushMainControllerFromLeft {
                self.hideLeftView(animated: true)
            }
