                 self.drawerViewController?.endAppearanceTransition()
                 self.mainViewController?.endAppearanceTransition()
                 self._isAppearing = nil
-                self.delegate?.drawerController?(self, stateChanged: state)
+
+                if let didChangeState = self.delegate?.drawerController(_:didChangeState:) {
+                    didChangeState(self, state)
+                } else {
+                    self.delegate?.drawerController?(self, stateChanged: state)
+                }
         }
     }
     

    /**************************************************************************/
    
    public func setDrawerState(_ state: DrawerState, animated: Bool) {
        _containerView.isHidden = false
        let duration: TimeInterval = animated ? drawerAnimationDuration : 0


import UIKit

@objc public protocol KYDrawerControllerDelegate {
    @objc optional func drawerController(_ drawerController: KYDrawerController, willChangeState state: KYDrawerController.DrawerState)
    @objc optional func drawerController(_ drawerController: KYDrawerController, didChangeState state: KYDrawerController.DrawerState)

    @available(*, deprecated, renamed: "drawerController(_:didChangeState:)")
    @objc optional func drawerController(_ drawerController: KYDrawerController, stateChanged state: KYDrawerController.DrawerState)
}

