     if collision {
       assert(values.count > 1, "Logic Error - can't have collection with less than two values")
       
-      guard let boldFont = getAdaptiveFont(bold: true) else {
+      guard let boldFont = getFont(bold: true) else {
         return
       }
       paintText(text: values[0], textRectFont: textRectFonts[0])
       let last = values.count - 1
       
-      if value == last {
-        paintText(text: values[last], textRectFont: textRectFonts[last], font: boldFont)
+      if discreteValue == last {
+        paintText(text: values[last], textRectFont: textRectFonts[last],
+          font: boldFont)
       } else {
         if false == endCollision {
-          paintText(text: values[value], textRectFont: textRectFonts[value], font: boldFont)
+          paintText(text: values[discreteValue],
+            textRectFont: textRectFonts[discreteValue], font: boldFont)
         }
         paintText(text: values[last], textRectFont: textRectFonts[last])
       }

    }
    return (rectFonts, collision, endCollision)
  }
  
  override func layoutSubviews() {
    super.layoutSubviews()
    setNeedsDisplay()
    slider.setNeedsDisplay()
  }
}

class MySlider : UISlider {
  let ballRadius : CGFloat = 6.0
  let horzFudge : CGFloat = 4.0
  
  var maxBallColor : UIColor = UIColor.lightGray
  let minBallColor : UIColor = UIColor.darkGray
  
  var values : [String] = [] {
    didSet {
      self.invalidateIntrinsicContentSize()
    }
  }
  var discreteValue : Int = 0
  var ballRects : [CGRect] = []
  var maxTextWidthAllowed : CGFloat = 0.0
  
  override func layoutSubviews() {
    super.layoutSubviews()
    ballRects.removeAll()
    let width : CGFloat = bounds.width
    let extra = ceil(bounds.height / 2.0)
    let y = bounds.origin.y + extra
    let cx = width / CGFloat(values.count - 1)
    maxTextWidthAllowed = cx
    
    let halfway = values.count / 2
    let even = values.count % 2 == 0
    
    // Do the fudgy thing.   In a perfect world, I'd figure out what exact
    // curve Apple is using to fudge the visual values of the 'ball' on the
    // slider, and match that here.   This linear fudging seems close enough to
    // get the labels and little balls and the big balls to pretty much look
    // like they match up on the line. I judge that, if more precision is
    // is needed, it'd be easier to just ditch the UISlider altogether, and
    // just draw it all myself.   It's just a BezierPath with some shading,
    // and a straight line.
    for i in 0..<self.values.count {
      var px : CGFloat = CGFloat(i) * cx + self.ballRadius
      if i < halfway && i > 0 {
        px += horzFudge
      } else if i >= halfway && i < values.count - 1{
        if i != halfway || even {
          px -= horzFudge
        }
      }
      
      let center : CGPoint = CGPoint(x: px, y: y)
      var rect = CGRect(x: center.x - self.ballRadius,
                        y: center.y - self.ballRadius, width: self.ballRadius * 2.0,
                        height: self.ballRadius * 2.0)
      
      if i == self.discreteValue {
        ballRects.append(rect)
        continue
      }
      
      if i == self.values.count - 1 {
        let rectOriginX = rect.origin.x
        let newRectOriginX = self.bounds.width - (self.ballRadius * 2)
        let offsetX = newRectOriginX - rectOriginX
        rect = rect.offsetBy(dx: offsetX, dy: 0.0)
      }
      
      ballRects.append(rect)
    }
  }
  
  override func draw(_ rect: CGRect) {
    maximumTrackTintColor = maxBallColor
    minimumTrackTintColor = minBallColor
    
    super.draw(rect)
    
    guard let context = UIGraphicsGetCurrentContext() else {
      return
    }
    
    for i in 0..<ballRects.count {
      if i == discreteValue {
        continue
      }
      let ballRect = ballRects[i]
      context.saveGState()
      let ball = UIBezierPath(ovalIn: ballRect)
      if i < discreteValue {
        minBallColor.setFill()
        ball.fill()
      } else {
        maxBallColor.setFill()
        ball.fill()
      }
      context.restoreGState()
    }
    
  }
}

// This is just a placeholder for whatever you need to do, Aarti.
fileprivate func getAdaptiveFont(bold: Bool) -> UIFont? {
  if false == bold {
    return UIFont.systemFont(ofSize: 12.0)
  }

      }
      
      let textRect = CGRect(x: x,
        y: sliderBottom + Constants.vertPad, width: textSize.width,
        height: textSize.height)
      
      if i > 0 {
        // pad things out a bit, and check for collision.
        let prevRect = rectFonts[i - 1].rect.insetBy(dx: -Constants.horzPad, dy: 0.0)
        let curRect = textRect.insetBy(dx: -Constants.horzPad, dy: 0.0)
        
