         return gesture
     }()
     
-    public weak var delegate         : KYDrawerControllerDelegate?
-    
-    public var drawerDirection      : DrawerDirection = .Left
-    
-    public var drawerState          : DrawerState! {
-        get {
-            return _containerView.hidden ? .Closed : .Opened
-        }
-        set {
-            setDrawerState(drawerState, animated: false)
-        }
-    }
-    
-    @IBInspectable public var drawerWidth: CGFloat = 280
+    public weak var delegate: KYDrawerControllerDelegate?
+    
+    public var drawerDirection: DrawerDirection = .Left {
+        didSet {
+            switch drawerDirection {
+            case .Left:  screenEdgePanGesture.edges = .Left
+            case .Right: screenEdgePanGesture.edges = .Right
+            }
+            let tmp = drawerViewController
+            drawerViewController = tmp
+        }
+    }
+    
+    public var drawerState: DrawerState {
+        get { return _containerView.hidden ? .Closed : .Opened }
+        set { setDrawerState(drawerState, animated: false) }
+    }
+    
+    @IBInspectable public var drawerWidth: CGFloat = 280 {
+        didSet { _drawerWidthConstraint?.constant = drawerWidth }
+    }
     
     public var mainViewController: UIViewController! {
         didSet {

        default:
            return touch.view == gestureRecognizer.view
        }
    }


}


                oldController.view.removeFromSuperview()
                oldController.removeFromParentViewController()
            }
            guard let mainViewController = mainViewController else { return }
            let viewDictionary      = ["mainView" : mainViewController.view]
            mainViewController.view.translatesAutoresizingMaskIntoConstraints = false
            addChildViewController(mainViewController)
            view.insertSubview(mainViewController.view, atIndex: 0)
            view.addConstraints(
                NSLayoutConstraint.constraintsWithVisualFormat(
                    "V:|-0-[mainView]-0-|",
                    options: [],
                    metrics: nil,
                    views: viewDictionary
                )
            )
            view.addConstraints(
                NSLayoutConstraint.constraintsWithVisualFormat(
                    "H:|-0-[mainView]-0-|",
                    options: [],
                    metrics: nil,
                    views: viewDictionary
                )
            )
            mainViewController.didMoveToParentViewController(self)
        }
    }
    
