@@ -60,7 +60,7 @@ public struct BandScale<CategoryType: Comparable, OutputType: BinaryFloatingPoin
6060 self . paddingOuter = paddingOuter
6161 self . domain = domain
6262 self . reversed = reversed
63- if let from = from , let to = to {
63+ if let from, let to {
6464 precondition ( from < to, " attempting to set an inverted or empty range: \( from) to \( to) " )
6565 rangeLower = from
6666 rangeHigher = to
@@ -71,7 +71,7 @@ public struct BandScale<CategoryType: Comparable, OutputType: BinaryFloatingPoin
7171 }
7272
7373 // testing function only - verifies the scale is fully configured
74- internal func fullyConfigured( ) -> Bool {
74+ func fullyConfigured( ) -> Bool {
7575 rangeLower != nil && rangeHigher != nil && domain. count > 0
7676 }
7777
@@ -139,7 +139,7 @@ public struct BandScale<CategoryType: Comparable, OutputType: BinaryFloatingPoin
139139
140140 // attributes of the scale when fully configured
141141
142- internal func width( ) -> Double ? {
142+ func width( ) -> Double ? {
143143 guard let from = rangeLower, let to = rangeHigher else {
144144 return nil
145145 }
@@ -163,7 +163,7 @@ public struct BandScale<CategoryType: Comparable, OutputType: BinaryFloatingPoin
163163 }
164164 }
165165
166- internal func step( ) -> Double ? {
166+ func step( ) -> Double ? {
167167 guard let width = width ( ) else {
168168 return nil
169169 }
@@ -186,11 +186,10 @@ public struct BandScale<CategoryType: Comparable, OutputType: BinaryFloatingPoin
186186 // the value to be scaled isn't within the domain
187187 return nil
188188 }
189- let doublePosition : Double
190- if reversed {
191- doublePosition = Double ( domain. reversed ( ) . firstIndex ( of: value) !)
189+ let doublePosition = if reversed {
190+ Double ( domain. reversed ( ) . firstIndex ( of: value) !)
192191 } else {
193- doublePosition = Double ( domain. firstIndex ( of: value) !)
192+ Double ( domain. firstIndex ( of: value) !)
194193 }
195194 let startLocation = Double ( paddingOuter) + ( doublePosition * step)
196195 let stopLocation = startLocation + width
@@ -243,11 +242,10 @@ public struct BandScale<CategoryType: Comparable, OutputType: BinaryFloatingPoin
243242 }
244243 // calculate the closest index
245244 let rangeExtentWithoutOuterPadding = Double ( upperRange) - Double( lowerRange) - 2 * Double( paddingOuter)
246- let indexedRangeValue : Double
247- if reversed {
248- indexedRangeValue = ( Double ( upperRange) - Double( paddingOuter) - Double( location) ) / rangeExtentWithoutOuterPadding
245+ let indexedRangeValue : Double = if reversed {
246+ ( Double ( upperRange) - Double( paddingOuter) - Double( location) ) / rangeExtentWithoutOuterPadding
249247 } else {
250- indexedRangeValue = ( Double ( location) - Double( paddingOuter) ) / rangeExtentWithoutOuterPadding
248+ ( Double ( location) - Double( paddingOuter) ) / rangeExtentWithoutOuterPadding
251249 }
252250 let rangeValueExpandedToCountDomain = indexedRangeValue * Double( domain. count - 1 )
253251
@@ -307,10 +305,10 @@ public extension BandScale {
307305 /// - Parameter formatter: An optional formatter to convert the domain values into strings.
308306 func defaultTickValues( formatter: Formatter ? = nil ) -> [ String ] {
309307 domain. map { value in
310- if let formatter = formatter {
311- return formatter. string ( for: value) ?? " "
308+ if let formatter {
309+ formatter. string ( for: value) ?? " "
312310 } else {
313- return String ( " \( value) " )
311+ String ( " \( value) " )
314312 }
315313 }
316314 }
0 commit comments