Repository: danielgindi/Charts
File: Source/Charts/Charts/PieRadarChartViewBase.swift (Swift)

Code before:
    
    #if !os(OSX)
    open override func nsuiTouchesBegan(_ touches: Set<NSUITouch>, withEvent event: NSUIEvent?)
    {
        // if rotation by touch is enabled
        if rotationEnabled
        {
            stopDeceleration()
            
            if !rotationWithTwoFingers, let touchLocation = touches.first?.location(in: self)
            {
                processRotationGestureBegan(location: touchLocation)
            }
        }
        
        if !_isRotating
        {
            super.nsuiTouchesBegan(touches, withEvent: event)
        }
    }
    
    open override func nsuiTouchesMoved(_ touches: Set<NSUITouch>, withEvent event: NSUIEvent?)
    {
        if rotationEnabled && !rotationWithTwoFingers
        {
            if let touch = touches.first {
                let touchLocation = touch.location(in: self)
                processRotationGestureMoved(location: touchLocation)
            }
        }
        
        if !_isRotating
        {
            super.nsuiTouchesMoved(touches, withEvent: event)
        }
    }
    
    open override func nsuiTouchesEnded(_ touches: Set<NSUITouch>, withEvent event: NSUIEvent?)
    {
        if !_isRotating
        {
            super.nsuiTouchesEnded(touches, withEvent: event)
        }
        
        if rotationEnabled && !rotationWithTwoFingers
        {
            if let touch = touches.first {
                let touchLocation = touch.location(in: self)
                processRotationGestureEnded(location: touchLocation)
            }
        }

Review comment (suggestion):
Can we move the `if let touch = touches.first` into `if rotationEnabled && !rotationWithTwoFingers`
i.e.
```
if rotationEnabled && !rotationWithTwoFingers, let touch = touches.first { ... }
```

Code after:
    
    #if !os(OSX)
    open override func nsuiTouchesBegan(_ touches: Set<NSUITouch>, withEvent event: NSUIEvent?)
    {
        // if rotation by touch is enabled
        if rotationEnabled
        {
            stopDeceleration()
            
            if !rotationWithTwoFingers, let touchLocation = touches.first?.location(in: self)
            {
                processRotationGestureBegan(location: touchLocation)
            }
        }
        
        if !_isRotating
        {
            super.nsuiTouchesBegan(touches, withEvent: event)
        }
    }
    
    open override func nsuiTouchesMoved(_ touches: Set<NSUITouch>, withEvent event: NSUIEvent?)
    {
        if rotationEnabled && !rotationWithTwoFingers, let touch = touches.first
        {
            let touchLocation = touch.location(in: self)
            processRotationGestureMoved(location: touchLocation)
        }
        
        if !_isRotating
        {
            super.nsuiTouchesMoved(touches, withEvent: event)
        }
    }
    
    open override func nsuiTouchesEnded(_ touches: Set<NSUITouch>, withEvent event: NSUIEvent?)
    {
        if !_isRotating
        {
            super.nsuiTouchesEnded(touches, withEvent: event)
        }
        
        if rotationEnabled && !rotationWithTwoFingers, let touch = touches.first
        {
            let touchLocation = touch.location(in: self)
            processRotationGestureEnded(location: touchLocation)
        }
        
        if _isRotating
        {
            _isRotating = false