     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 gen
    }
  }
  
  private var textHeight : CGFloat = 0.0
  
  private let nameLabel : UILabel = {
    let l = UILabel()
    l.font = getAdaptiveFont(bold: true)
    l.textAlignment = .left
    
    return l
  }()
  
  //MARK: Inspectable and public non-inspectable properties
  @IBInspectable var name : String = "SliderName" {
    didSet {
      nameLabel.text = name
    }
  }
  
  @IBInspectable var doHaptic : Bool = true
  
  @IBInspectable var slider : MySlider = MySlider()
  
  var type : DiscreteSliderType = .continuous
  
  @available(*, unavailable, message: "This property is reserved for Interface Builder")
  @IBInspectable var sliderType : String? {
    willSet {
      if let newType = DiscreteSliderType(rawValue: newValue?.lowercased() ?? "") {
        type = newType
      }
    }
  }
  
  // Arrays can't be IBInspectable, dang.
  var values : [String] = [] {
    didSet {
      let count = values.count
      slider.minimumValue = 0.0
      slider.maximumValue = Float(count - 1)
      invalidateIntrinsicContentSize()
      slider.values = values
    }
  }
  
  var value : Int = 0 {
    didSet {
      guard value < values.count && value >= 0 && values.count > 0 else {
        return
      }
      slider.value = Float(value)
      slider.discreteValue = value
      slider.setNeedsDisplay()
      setNeedsDisplay()
    }
  }
  
  var valueString : String? {
    guard values.count > 0 else {
      return nil
    }
    assert(value < values.count && values.count >= 0, "ummm, nope")
    return values[value]
  }
  
  override init(frame: CGRect) {

//
//  DiscreteSlider.swift
//  DiscreteSlider
//
//  Created by Don Clore on 7/30/17.
//  Copyright © 2017 Don Clore. All rights reserved.
//

import UIKit

public class DiscreteSlider : UIControl {
  //MARK: Constants
  struct Constants {
    static let sliderHeight : CGFloat = 40.0
    static let vertPad : CGFloat = 7.0
    static let horzPad : CGFloat = 3.0
  }

  let trackHeight : CGFloat = 2.0
  let ballRadius : CGFloat = 6.0
  
  let selectorRadius : CGFloat = 14.0
  let shadowRadius : CGFloat = 4.0
  let shadowOffset : CGSize = CGSize(width: 0.0, height: 3.0)
  
  fileprivate var touchOffsetX : CGFloat = 0.0
  
  fileprivate let selector : CALayer = CALayer()
  fileprivate let trackLine : CALayer = CALayer()
  fileprivate let maxLine : CALayer = CALayer()
  fileprivate let minLine : CALayer = CALayer()
  
  fileprivate var trackRect : CGRect = CGRect.zero
  
  fileprivate var thumbX : CGFloat = 0.0 {
    didSet {
      let maxX = trackRect.maxX - (selectorRadius * 2)
      if thumbX > maxX {
        thumbX = maxX
      }
    }
  }
  
  var maximumTrackTintColor : UIColor = UIColor.darkGray
  var minimumTrackTintColor : UIColor = UIColor.lightGray
  
  var minimumValue : CGFloat = 0.0
  var maximumValue : CGFloat = CGFloat.greatestFiniteMagnitude

  
  //MARK: Private properties
  @available(iOS 10.0, *)
