title: Getting values for two labels from single UIPicker
body: <p><a href="https://i.stack.imgur.com/Z5Eto.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Z5Eto.png" alt="enter image description here"></a>Trying to fill two labels using single UIPicker. It has one column, two labels which have two buttons at the end of each label. On clicking which the UIPicker view is shown  </p>
  
  <pre><code>@IBOutlet weak var userLoc1: UILabel!
  @IBOutlet weak var userLoc2: UILabel!
  
  let location = ["location1", "Location2", "Location3", 
  "Location4", "Location5", "Location6", "Location7"]
  
  
  func numberOfComponents(in pickerView: UIPickerView) -&gt; Int {
      return 1
  }
  
  func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -&gt; Int {
      var countRow:Int = 0
  
      if pickerView == LocationPickerView{
      countRow = self.location.count
      }
      return countRow
  }
  
  func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -&gt; String? {
      if pickerView == LocationPickerView
      {
      let titleLocation = location[row]
          return titleLocation
      }
      return ""
  }
  
  func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
      if pickerView == LocationPickerView
      {
          selectedLocation1 = self.location[row]
          self.userLoc1.text = self.location[row]
          self.LocationPickerView.isHidden = true
  
   //anything that can be done here that can assign different values to 
    //two label  using the same UIPicker
  
      }
  </code></pre>
  
  <p>Any guide to resolve the matter is greatly appreciated </p>