                            animations: {
                             self.view.layoutIfNeeded()
             }) { finished in
-                self.delegate?.sideController(self, didChangeTo: state)
+                if finished {
+                    self.delegate?.sideController(self, didChangeTo: state)
+                }
             }
         case .transitioning:
             break

        }
    }
    
    @objc fileprivate func handleTapGesture(gr: UITapGestureRecognizer) {
        guard  !self.sideContainerView.frame.contains(gr.location(in: self.view)) else { return }
        
        switch self._state {
        case .front:
            self.performTransition(to: .side)
        case .side:
            self.performTransition(to: .front)
        case .transitioning:
        break
        }
    }
    
    private func handlePanGestureBegan(with recognizer: UIPanGestureRecognizer) {
        self.panPreviousLocation = recognizer.location(in: self.view)
    }

//MARK: Private properties
    fileprivate(set) var _state: Presenting {
        willSet(newState) {
            self.performTransition(to: newState)
            self.delegate?.sideController(self, willChangeTo: newState)
        }
        didSet {
            switch self._state {
            case .front:
                self.disableTapGesture()
            case .side:
                self.enablePanGesture()
            default:
                break
            }
        }
    }
