Question: I'm trying to pre select a table row when the view load, however i have tried several methods, but none seem to work. At first i've set following two methods in order to define the textColor changes when a row is selected and deselected

```
open func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath) {
    let cell = menuCells[indexPath.row]

    cell.textLabel?.textColor = UIColor.white.withAlphaComponent(0.4)
}

open func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    let cell = menuCells[indexPath.row]

    cell.textLabel?.textColor = UIColor.white.withAlphaComponent(1.0)

    UIApplication.shared.sendAction(cell.menuAction, to: cell.menuTarget, from: cell, for: nil)
}

```

Then i've tried to do following things to preselect a row but it does not seem to change the textColor with alpha to 1.0

```
open func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {

    if indexPath.row == 0 {
        cell.setSelected(true, animated: false)
    }
}

menuView.selectRow(at: IndexPath(row: 0, section: 0), animated: false, scrollPosition: UITableViewScrollPosition.none)

```

Answer: 
Is this what you're after?

```
override func viewWillAppear(animated: Bool) {
        super.viewWillAppear(animated)

        let iPath = NSIndexPath(forRow: 0, inSection: 0)
        tableView.selectRowAtIndexPath(iPath, animated: true, scrollPosition: .Top )
    }

```
I think it's most appropriate to select the row in the `viewWillAppear` method as the view must have been fully initialized.

The example below selects the first cell of the first section:

```swift
override func viewWillAppear(_ animated: Bool) {
    let selectedIndexPath = IndexPath(row: 0, section: 0)
    tableView.selectRow(at: selectedIndexPath, animated: true, scrollPosition: UITableViewScrollPosition.none)
    tableView(tableView, didSelectRowAt: selectedIndexPath)
}

```