title: Select item from list in another view
body: <p>I have a <strong>Select state</strong> button. When user click to it, he see new table view with list of states. When he select one, he go back to previous view(it has a navigation bar controller) and button name changed to selected state.</p>
  
  <p>I understand the principle i create a segue where send <code>selectedState</code>, but how to go back with selected value i don't know. And have another bug </p>
  
  <p><a href="https://i.stack.imgur.com/ORgWe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ORgWe.png" alt="enter image description here"></a></p>
  
  <p>Table view selects two cells. Here is my code:</p>
  
  <pre><code>class StateTableViewController: UITableViewController {
      let selectedState:String = "AZ"
      let states = ["AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DC", "DE", "FL", "GA",
          "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD",
          "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ",
          "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC",
          "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY"]
  
  
      override func viewDidLoad() {
          super.viewDidLoad()
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
      }
  
      // MARK: - Table view data source
  
      override func numberOfSectionsInTableView(tableView: UITableView) -&gt; Int {
          return 1
      }
  
      override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
          return self.states.count
      }
  
  
      override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
          let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath)
  
          // Configure the cell...
          cell.textLabel?.text = self.states[indexPath.row]
  
          if (self.states[indexPath.row] == self.selectedState) {
              cell.accessoryType = UITableViewCellAccessoryType.Checkmark
          }
  
          return cell
      }
  }
  </code></pre>
  
  <p>This question is similar <a href="https://stackoverflow.com/questions/30586142/how-to-create-selecting-option-uitableview-similar-in-ios-settings-in-swift">How to create selecting option UITableView similar in iOS Settings in Swift?</a></p>
  
  <p>but i don't understand it :(</p>