title: Picker View, how to return index of the selected item. Swift 4
body: <p>I tried to return the index of the selected item in picker View, but I did not succeed. I need to transfer the index of the element when I click the button, then, depending on the index, call a specific function.</p>
  
  <pre><code>@IBAction func myButton(_ sender: UIButton) {
      let row = [pickerView.selectedRow(inComponent: 0)]
  }
  </code></pre>
  
  <p>I tried to print the value of row into the console and it turned out, but when I try to create a condition if row = 0 and etc. I get an error. Help me please!</p>