title: Handle UISlider value in the best way
body: <p>Sorry for this question, and I need an advice here.
  I have an slider to change a value in a chart (distance between two points), and I did it in this way, I think this is the worst way to do that, but I can find any better way, could anyone help me to make it in a nicer way, more advance!</p>
  <p>Your help will be appreciated</p>
  <pre class="lang-swift prettyprint-override"><code>@objc func stockSliderValueChanged(sender: UISlider) {
      let value = sender.value
  
      stockChart.lineGap = 0.7
  
      if value == 0 {
          stockChart.lineGap = stockChart.lineGap - 0.5
      } else if value &gt; 0.0, value &lt;= 0.1 {
          stockChart.lineGap = stockChart.lineGap - 0.45
      } else if value &gt; 0.1, value &lt;= 0.15 {
          stockChart.lineGap = stockChart.lineGap - 0.4
      } else if value &gt; 0.15, value &lt;= 0.2 {
          stockChart.lineGap = stockChart.lineGap - 0.35
      } else if value &gt; 0.2, value &lt;= 0.25 {
          stockChart.lineGap = stockChart.lineGap - 0.3
      } else if value &gt; 0.25, value &lt;= 0.3 {
          stockChart.lineGap = stockChart.lineGap - 0.25
      } else if value &gt; 0.3, value &lt;= 0.35 {
          stockChart.lineGap = stockChart.lineGap - 0.2
      } else if value &gt; 0.35, value &lt;= 0.4 {
          stockChart.lineGap = stockChart.lineGap - 0.15
      } else if value &gt; 0.4, value &lt;= 0.45 {
          stockChart.lineGap = stockChart.lineGap - 0.1
      } else if value &gt; 0.45, value &lt;= 5 {
          stockChart.lineGap = stockChart.lineGap - 0.05
      }
  
      if value &gt; 0.5, value &lt;= 0.55 {
          stockChart.lineGap = stockChart.lineGap + 0.05
      } else if value &gt; 0.55, value &lt;= 0.6 {
          stockChart.lineGap = stockChart.lineGap + 0.1
      } else if value &gt; 0.6, value &lt;= 0.65 {
          stockChart.lineGap = stockChart.lineGap + 0.15
      } else if value &gt; 0.65, value &lt;= 0.7 {
          stockChart.lineGap = stockChart.lineGap + 0.2
      } else if value &gt; 0.7, value &lt;= 0.75 {
          stockChart.lineGap = stockChart.lineGap + 0.25
      } else if value &gt; 0.75, value &lt;= 0.8 {
          stockChart.lineGap = stockChart.lineGap + 0.3
      } else if value &gt; 0.8, value &lt;= 0.85 {
          stockChart.lineGap = stockChart.lineGap + 0.35
      } else if value &gt; 0.85, value &lt;= 0.9 {
          stockChart.lineGap = stockChart.lineGap + 0.4
      } else if value &gt; 0.9, value &lt;= 0.95 {
          stockChart.lineGap = stockChart.lineGap + 0.45
      } else if value &gt; 0.95, value &lt;= 1 {
          stockChart.lineGap = stockChart.lineGap + 0.5
      }
      stockChart.reDraw()
  }
  </code></pre>