                 else {
                     self.contentView?.insertSubview((self.leftViewController?.view)!, belowSubview: (self.mainViewController?.view)!)
                 }
-                addChildViewController(self.leftViewController!)
-                self.leftViewController?.didMove(toParentViewController: self)
+                addChild(self.leftViewController!)
+                self.leftViewController?.didMove(toParent: self)
             }
             var leftFrame: CGRect = self.leftViewController!.view.frame
             var mainFrame: CGRect = self.mainViewController!.view.frame

            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!

    @objc public init(leftViewController: UIViewController?, mainViewController: UIViewController, rightViewController: UIViewController?) {
        super.init(nibName: nil, bundle: nil)
        
        addChild(mainViewController)
        mainViewController.didMove(toParent: self)
        self.mainViewController = mainViewController
        if (leftViewController != nil) {
            addChild(leftViewController!)
            leftViewController!.didMove(toParent: self)
        }
        self.leftViewController = leftViewController
        if rightViewController != nil {
            addChild(rightViewController!)
            rightViewController!.didMove(toParent: self)
        }
        self.rightViewController = rightViewController
        
