I've been trying to pass a title(String) from a cell to another controller via a segue, and actually it works, but a behaviour is totally wrong. 

*main controller*

```
var cellTitlePressed:String?

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    cellTitlePressed = categories[indexPath.row].title
    performSegue(withIdentifier: "toCategory", sender: self)
}

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    if let destination = segue.destination as? CategoryVC {
        if let title = cellTitlePressed {
            destination.categoryTitle = title
        } else {
            destination.categoryTitle = "Undefined category"
        }
    }
}

```

If I click on a cell('Beer' category for example) I see "Undefined category" title so I guess the condition doesn't work at first time.

*destination controller*

```
private var _categoryTitle: String!

var categoryTitle:String {
    get {
        return _categoryTitle
    }
    set {
        _categoryTitle = newValue
    }
}

@IBOutlet weak var categoryTitleLabel: UILabel!

@IBAction func backButtonPressed(_ sender: AnyObject) {
    dismiss(animated: true, completion: nil)

}

override func viewDidLoad() {
    super.viewDidLoad()
}

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    categoryTitleLabel.text = categoryTitle
}

```

Then I come back(dismiss) and click on another category('Coffee') and I see the previous title - 'Beer' instead of 'Coffee' and so on. So it always delayed by one step.