title: How to find index of selected item within a UIStackView Swift 4
body: <p>I have 5 buttons within a UIStackView, and I want to find out which index is being selected, and later compare those indexes. My code right now gives me an Array.Index. I've tried both subviews and arrangedSubviews. Is there anyway I can turn this into an Integer? I can't figure it out. Thanks!!</p>
  
  <pre><code>if let selectedIndex = stackview.subviews.index(of: sender) {
  
  }
  </code></pre>
  
  <p>// UPDATE
  I kinda got what I wanted with:</p>
  
  <pre><code>let int = stackview.subviews.distance(from: stackview.subviews.startIndex, to: selectedIndex)
  </code></pre>
  
  <p>I'm still not sure if this is the most efficient way, but it does the job for now.</p>