 
 // MARK: - Extensions -
 
-extension RotatingButtonsViewController: CAAnimationDelegate {
-    
-    func animationDidStop(_ anim: CAAnimation, finished flag: Bool) {
-        switch self.state {
-        case .left:
-            leftButtonLeftAnchor?.isActive = false
-            leftButtonRightAnchor?.isActive = true
-            rightButtonLeftAnchor?.isActive = true
-            rightButtonRightAnchor?.isActive = false
-            view.bringSubview(toFront: leftButton)
-            self.state = .right
-        case .right:
-            leftButtonLeftAnchor?.isActive = true
-            leftButtonRightAnchor?.isActive = false
-            rightButtonLeftAnchor?.isActive = false
-            rightButtonRightAnchor?.isActive = true
-            view.bringSubview(toFront: rightButton)
-            self.state = .left
-        }
-        leftButton.layoutIfNeeded()
-        rightButton.layoutIfNeeded()
-        isAnimating.value = false
-    }
+extension RotatingButtonsViewController: RotatingButtonsViewModelDelegate {
     
 }
-
-extension RotatingButtonsViewController: RotatingButtonsViewModelDelegate {
-    
-}

    var leftButtonRightAnchor: NSLayoutConstraint?
    var rightButtonLeftAnchor: NSLayoutConstraint?
    var rightButtonRightAnchor: NSLayoutConstraint?
    let isAnimating = Variable(false)
    
    // MARK: - Init
    

    let animationDuration: TimeInterval
    let enterString: String
    let exitString: String
    var leftButtonAnimation: CAAnimationGroup!
    lazy var leftButton: UIButton = {
        let button = self.createButton()
        self.createTapEvent(forButton: button).subscribe(onNext: { _ in
            self.handleEndAnimation(isLeftButton: true)
            }).addDisposableTo(self.rx_disposeBag)
        button.backgroundColor = .green
        button.setTitle(self.enterString, for: .normal)
        return button
    }()
    lazy var rightButton: UIButton = {
        let button = self.createButton()
        self.createTapEvent(forButton: button).subscribe(onNext: { _ in
            self.handleEndAnimation(isLeftButton: false)
            }).addDisposableTo(self.rx_disposeBag)
        button.backgroundColor = .red
        button.setTitle(self.exitString, for: .normal)
        return button
