浏览代码

Make Clamped internal

Jacob Christie 4 年之前
父节点
当前提交
d98bb4d576

+ 6 - 1
Source/Charts/Charts/ChartViewBase.swift

@@ -829,8 +829,13 @@ open class ChartViewBase: NSUIView, ChartDataProvider, AnimatorDelegate
     /// 1 is an invalid value, and will be converted to 0.999 automatically.
 
     @objc
+    open var dragDecelerationFrictionCoef: CGFloat {
+        get { _dragDecelerationFrictionCoef }
+        set { _dragDecelerationFrictionCoef = newValue }
+    }
+    
     @Clamped(0...0.999)
-    open var dragDecelerationFrictionCoef: CGFloat = 0.9
+    private var _dragDecelerationFrictionCoef: CGFloat = 0.9
 
     //
     /// The maximum distance in screen pixels away from an entry causing it to highlight.

+ 7 - 1
Source/Charts/Data/Implementations/Standard/PieChartDataSet.swift

@@ -49,8 +49,14 @@ open class PieChartDataSet: ChartDataSet, PieChartDataSetProtocol
     /// the space in pixels between the pie-slices
     /// **default**: 0
     /// **maximum**: 20
+    @objc
+    open var sliceSpace: CGFloat {
+        get { _sliceSpace }
+        set { _sliceSpace = newValue }
+    }
+
     @Clamped(0...20)
-    open var sliceSpace: CGFloat = 0
+    private var _sliceSpace: CGFloat = 0
 
     /// When enabled, slice spacing will be 0.0 when the smallest value is going to be smaller than the slice spacing itself.
     open var automaticallyDisableSliceSpacing: Bool = false

+ 3 - 3
Source/Charts/Utils/Property Wrappers/Clamped.swift

@@ -8,12 +8,12 @@
 import Foundation
 
 @propertyWrapper
-public struct Clamped<Value: Comparable> {
+struct Clamped<Value: Comparable> {
     private var storage: Value
 
     let range: ClosedRange<Value>
 
-    public var wrappedValue: Value {
+    var wrappedValue: Value {
         get { storage }
         set { storage = max(range.lowerBound, min(storage, range.upperBound)) }
     }
@@ -26,7 +26,7 @@ public struct Clamped<Value: Comparable> {
 }
 
 extension Clamped where Value: Strideable, Value.Stride: SignedInteger {
-    public init(wrappedValue value: Value, _ range: Swift.Range<Value>) {
+    init(wrappedValue value: Value, _ range: Swift.Range<Value>) {
         self.init(wrappedValue: value, ClosedRange(range))
     }
 }