Skip to content

Commit

Permalink
fileprivate -> private (#3042)
Browse files Browse the repository at this point in the history
almsot all cases of fileprivate were meant to be private. If there is a need to use fileprivate in the future, it should be considered then. Not now.
  • Loading branch information
jjatie authored and liuxuan30 committed Dec 8, 2017
1 parent 60829b3 commit 8c9d5f3
Show file tree
Hide file tree
Showing 41 changed files with 202 additions and 202 deletions.
26 changes: 13 additions & 13 deletions Source/Charts/Animation/Animator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,22 @@ open class Animator: NSObject
/// the phase that is animated and influences the drawn values on the y-axis
@objc open var phaseY: Double = 1.0

fileprivate var _startTimeX: TimeInterval = 0.0
fileprivate var _startTimeY: TimeInterval = 0.0
fileprivate var _displayLink: NSUIDisplayLink?
private var _startTimeX: TimeInterval = 0.0
private var _startTimeY: TimeInterval = 0.0
private var _displayLink: NSUIDisplayLink?

fileprivate var _durationX: TimeInterval = 0.0
fileprivate var _durationY: TimeInterval = 0.0
private var _durationX: TimeInterval = 0.0
private var _durationY: TimeInterval = 0.0

fileprivate var _endTimeX: TimeInterval = 0.0
fileprivate var _endTimeY: TimeInterval = 0.0
fileprivate var _endTime: TimeInterval = 0.0
private var _endTimeX: TimeInterval = 0.0
private var _endTimeY: TimeInterval = 0.0
private var _endTime: TimeInterval = 0.0

fileprivate var _enabledX: Bool = false
fileprivate var _enabledY: Bool = false
private var _enabledX: Bool = false
private var _enabledY: Bool = false

fileprivate var _easingX: ChartEasingFunctionBlock?
fileprivate var _easingY: ChartEasingFunctionBlock?
private var _easingX: ChartEasingFunctionBlock?
private var _easingY: ChartEasingFunctionBlock?

public override init()
{
Expand Down Expand Up @@ -119,7 +119,7 @@ open class Animator: NSObject
}
}

@objc fileprivate func animationLoop()
@objc private func animationLoop()
{
let currentTime: TimeInterval = CACurrentMediaTime()

Expand Down
4 changes: 2 additions & 2 deletions Source/Charts/Charts/BarChartView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import CoreGraphics
open class BarChartView: BarLineChartViewBase, BarChartDataProvider
{
/// if set to true, all values are drawn above their bars, instead of below their top
fileprivate var _drawValueAboveBarEnabled = true
private var _drawValueAboveBarEnabled = true

/// if set to true, a grey area is drawn behind each bar that indicates the maximum value
fileprivate var _drawBarShadowEnabled = false
private var _drawBarShadowEnabled = false

internal override func initialize()
{
Expand Down
58 changes: 29 additions & 29 deletions Source/Charts/Charts/BarLineChartViewBase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ open class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChartD
internal var _maxVisibleCount = 100

/// flag that indicates if auto scaling on the y axis is enabled
fileprivate var _autoScaleMinMaxEnabled = false
private var _autoScaleMinMaxEnabled = false

fileprivate var _pinchZoomEnabled = false
fileprivate var _doubleTapToZoomEnabled = true
fileprivate var _dragXEnabled = true
fileprivate var _dragYEnabled = true
private var _pinchZoomEnabled = false
private var _doubleTapToZoomEnabled = true
private var _dragXEnabled = true
private var _dragYEnabled = true

fileprivate var _scaleXEnabled = true
fileprivate var _scaleYEnabled = true
private var _scaleXEnabled = true
private var _scaleYEnabled = true

/// the color for the background of the chart-drawing area (everything behind the grid lines).
@objc open var gridBackgroundColor = NSUIColor(red: 240/255.0, green: 240/255.0, blue: 240/255.0, alpha: 1.0)
Expand Down Expand Up @@ -79,7 +79,7 @@ open class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChartD
internal var _panGestureRecognizer: NSUIPanGestureRecognizer!

/// flag that indicates if a custom viewport offset has been set
fileprivate var _customViewPortEnabled = false
private var _customViewPortEnabled = false

public override init(frame: CGRect)
{
Expand Down Expand Up @@ -272,8 +272,8 @@ open class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChartD
drawMarkers(context: context)
}

fileprivate var _autoScaleLastLowestVisibleX: Double?
fileprivate var _autoScaleLastHighestVisibleX: Double?
private var _autoScaleLastLowestVisibleX: Double?
private var _autoScaleLastHighestVisibleX: Double?

/// Performs auto scaling of the axis by recalculating the minimum and maximum y-values based on the entries currently in view.
internal func autoScale()
Expand Down Expand Up @@ -497,27 +497,27 @@ open class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChartD

// MARK: - Gestures

fileprivate enum GestureScaleAxis
private enum GestureScaleAxis
{
case both
case x
case y
}

fileprivate var _isDragging = false
fileprivate var _isScaling = false
fileprivate var _gestureScaleAxis = GestureScaleAxis.both
fileprivate var _closestDataSetToTouch: IChartDataSet!
fileprivate var _panGestureReachedEdge: Bool = false
fileprivate weak var _outerScrollView: NSUIScrollView?
private var _isDragging = false
private var _isScaling = false
private var _gestureScaleAxis = GestureScaleAxis.both
private var _closestDataSetToTouch: IChartDataSet!
private var _panGestureReachedEdge: Bool = false
private weak var _outerScrollView: NSUIScrollView?

fileprivate var _lastPanPoint = CGPoint() /// This is to prevent using setTranslation which resets velocity
private var _lastPanPoint = CGPoint() /// This is to prevent using setTranslation which resets velocity

fileprivate var _decelerationLastTime: TimeInterval = 0.0
fileprivate var _decelerationDisplayLink: NSUIDisplayLink!
fileprivate var _decelerationVelocity = CGPoint()
private var _decelerationLastTime: TimeInterval = 0.0
private var _decelerationDisplayLink: NSUIDisplayLink!
private var _decelerationVelocity = CGPoint()

@objc fileprivate func tapGestureRecognized(_ recognizer: NSUITapGestureRecognizer)
@objc private func tapGestureRecognized(_ recognizer: NSUITapGestureRecognizer)
{
if _data === nil
{
Expand All @@ -543,7 +543,7 @@ open class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChartD
}
}

@objc fileprivate func doubleTapGestureRecognized(_ recognizer: NSUITapGestureRecognizer)
@objc private func doubleTapGestureRecognized(_ recognizer: NSUITapGestureRecognizer)
{
if _data === nil
{
Expand Down Expand Up @@ -572,7 +572,7 @@ open class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChartD
}

#if !os(tvOS)
@objc fileprivate func pinchGestureRecognized(_ recognizer: NSUIPinchGestureRecognizer)
@objc private func pinchGestureRecognized(_ recognizer: NSUIPinchGestureRecognizer)
{
if recognizer.state == NSUIGestureRecognizerState.began
{
Expand Down Expand Up @@ -662,7 +662,7 @@ open class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChartD
}
#endif

@objc fileprivate func panGestureRecognized(_ recognizer: NSUIPanGestureRecognizer)
@objc private func panGestureRecognized(_ recognizer: NSUIPanGestureRecognizer)
{
if recognizer.state == NSUIGestureRecognizerState.began && recognizer.nsuiNumberOfTouches() > 0
{
Expand Down Expand Up @@ -783,7 +783,7 @@ open class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChartD
}
}

fileprivate func performPanChange(translation: CGPoint) -> Bool
private func performPanChange(translation: CGPoint) -> Bool
{
var translation = translation

Expand Down Expand Up @@ -815,7 +815,7 @@ open class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChartD
return matrix.tx != originalMatrix.tx || matrix.ty != originalMatrix.ty
}

fileprivate func isTouchInverted() -> Bool
private func isTouchInverted() -> Bool
{
return isAnyAxisInverted &&
_closestDataSetToTouch !== nil &&
Expand All @@ -831,7 +831,7 @@ open class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChartD
}
}

@objc fileprivate func decelerationLoop()
@objc private func decelerationLoop()
{
let currentTime = CACurrentMediaTime()

Expand Down Expand Up @@ -864,7 +864,7 @@ open class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChartD
}
}

fileprivate func nsuiGestureRecognizerShouldBegin(_ gestureRecognizer: NSUIGestureRecognizer) -> Bool
private func nsuiGestureRecognizerShouldBegin(_ gestureRecognizer: NSUIGestureRecognizer) -> Bool
{
if gestureRecognizer == _panGestureRecognizer
{
Expand Down
8 changes: 4 additions & 4 deletions Source/Charts/Charts/ChartViewBase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ open class ChartViewBase: NSUIView, ChartDataProvider, AnimatorDelegate
internal var _data: ChartData?

/// Flag that indicates if highlighting per tap (touch) is enabled
fileprivate var _highlightPerTapEnabled = true
private var _highlightPerTapEnabled = true

/// If set to true, chart continues to scroll after touch up
@objc open var dragDecelerationEnabled = true

/// Deceleration friction coefficient in [0 ; 1] interval, higher values indicate that speed will decrease slowly, for example if it set to 0, it will stop immediately.
/// 1 is an invalid value, and will be converted to 0.999 automatically.
fileprivate var _dragDecelerationFrictionCoef: CGFloat = 0.9
private var _dragDecelerationFrictionCoef: CGFloat = 0.9

/// if true, units are drawn next to the values in the chart
internal var _drawUnitInChart = false
Expand Down Expand Up @@ -154,7 +154,7 @@ open class ChartViewBase: NSUIView, ChartDataProvider, AnimatorDelegate
internal var _animator: Animator!

/// flag that indicates if offsets calculation has already been done or not
fileprivate var _offsetsCalculated = false
private var _offsetsCalculated = false

/// array of Highlight objects that reference the highlighted slices in the chart
internal var _indicesToHighlight = [Highlight]()
Expand All @@ -170,7 +170,7 @@ open class ChartViewBase: NSUIView, ChartDataProvider, AnimatorDelegate
/// The marker that is displayed when a value is clicked on the chart
@objc open var marker: IMarker?

fileprivate var _interceptTouchEvents = false
private var _interceptTouchEvents = false

/// An extra offset to be appended to the viewport's top
@objc open var extraTopOffset: CGFloat = 0.0
Expand Down
42 changes: 21 additions & 21 deletions Source/Charts/Charts/PieChartView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,57 +20,57 @@ import CoreGraphics
open class PieChartView: PieRadarChartViewBase
{
/// rect object that represents the bounds of the piechart, needed for drawing the circle
fileprivate var _circleBox = CGRect()
private var _circleBox = CGRect()

/// flag indicating if entry labels should be drawn or not
fileprivate var _drawEntryLabelsEnabled = true
private var _drawEntryLabelsEnabled = true

/// array that holds the width of each pie-slice in degrees
fileprivate var _drawAngles = [CGFloat]()
private var _drawAngles = [CGFloat]()

/// array that holds the absolute angle in degrees of each slice
fileprivate var _absoluteAngles = [CGFloat]()
private var _absoluteAngles = [CGFloat]()

/// if true, the hole inside the chart will be drawn
fileprivate var _drawHoleEnabled = true
private var _drawHoleEnabled = true

fileprivate var _holeColor: NSUIColor? = NSUIColor.white
private var _holeColor: NSUIColor? = NSUIColor.white

/// Sets the color the entry labels are drawn with.
fileprivate var _entryLabelColor: NSUIColor? = NSUIColor.white
private var _entryLabelColor: NSUIColor? = NSUIColor.white

/// Sets the font the entry labels are drawn with.
fileprivate var _entryLabelFont: NSUIFont? = NSUIFont(name: "HelveticaNeue", size: 13.0)
private var _entryLabelFont: NSUIFont? = NSUIFont(name: "HelveticaNeue", size: 13.0)

/// if true, the hole will see-through to the inner tips of the slices
fileprivate var _drawSlicesUnderHoleEnabled = false
private var _drawSlicesUnderHoleEnabled = false

/// if true, the values inside the piechart are drawn as percent values
fileprivate var _usePercentValuesEnabled = false
private var _usePercentValuesEnabled = false

/// variable for the text that is drawn in the center of the pie-chart
fileprivate var _centerAttributedText: NSAttributedString?
private var _centerAttributedText: NSAttributedString?

/// the offset on the x- and y-axis the center text has in dp.
fileprivate var _centerTextOffset: CGPoint = CGPoint()
private var _centerTextOffset: CGPoint = CGPoint()

/// indicates the size of the hole in the center of the piechart
///
/// **default**: `0.5`
fileprivate var _holeRadiusPercent = CGFloat(0.5)
private var _holeRadiusPercent = CGFloat(0.5)

fileprivate var _transparentCircleColor: NSUIColor? = NSUIColor(white: 1.0, alpha: 105.0/255.0)
private var _transparentCircleColor: NSUIColor? = NSUIColor(white: 1.0, alpha: 105.0/255.0)

/// the radius of the transparent circle next to the chart-hole in the center
fileprivate var _transparentCircleRadiusPercent = CGFloat(0.55)
private var _transparentCircleRadiusPercent = CGFloat(0.55)

/// if enabled, centertext is drawn
fileprivate var _drawCenterTextEnabled = true
private var _drawCenterTextEnabled = true

fileprivate var _centerTextRadiusPercent: CGFloat = 1.0
private var _centerTextRadiusPercent: CGFloat = 1.0

/// maximum angle for this pie
fileprivate var _maxAngle: CGFloat = 360.0
private var _maxAngle: CGFloat = 360.0

public override init(frame: CGRect)
{
Expand Down Expand Up @@ -182,7 +182,7 @@ open class PieChartView: PieRadarChartViewBase
}

/// calculates the needed angles for the chart slices
fileprivate func calcAngles()
private func calcAngles()
{
_drawAngles = [CGFloat]()
_absoluteAngles = [CGFloat]()
Expand Down Expand Up @@ -247,13 +247,13 @@ open class PieChartView: PieRadarChartViewBase
}

/// calculates the needed angle for a given value
fileprivate func calcAngle(_ value: Double) -> CGFloat
private func calcAngle(_ value: Double) -> CGFloat
{
return calcAngle(value: value, yValueSum: (_data as! PieChartData).yValueSum)
}

/// calculates the needed angle for a given value
fileprivate func calcAngle(value: Double, yValueSum: Double) -> CGFloat
private func calcAngle(value: Double, yValueSum: Double) -> CGFloat
{
return CGFloat(value) / CGFloat(yValueSum) * _maxAngle
}
Expand Down
Loading

0 comments on commit 8c9d5f3

Please sign in to comment.