My code below presents a view controller programmatically upon the user touch of a row in a table view. The code resides in 'didSelectRowtIndex' path and the table view resides in a ViewController class, where I've implemented table view delegates. The problem I'm having is that the view controllers I'm trying to present only appear on the second touch of the table view row. However when the parent view controller first loads, they appear on the first touch. Below is the code in 'didSelectRowAtIndexPath' for the presentation of the two of the child view controllers:
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.row == 0 {
let stockTable = StockTableVC()
self.present(stockTable, animated: false, completion: nil)
}
else indexPath.row == 1 {
let accountTable = AccountTableVC()
self.present(accountTable, animated: false, completion: nil)
}
...
Both present view controller methods above are being called every time upon row selection, but somtimes aren't presenting on the first selection (or at least they are not visible). Any help with this mystery would be great.
-Thanks