How to pass an Index Path to another table

Say you have a central array somewhere and would like display this in more detail via two table view controllers. Instead of passing only the relevant information, you want to pass the entire index path from table1 to table2 and beyond.

You can pass data in the prepareForSegue:sender method and let the Storyboard to the heavy lifting:

Here we instantiate a new Table2 object on which myIndexPath is a property. Then we set it to our own table’s selected indexPath. In Table2 we can then pick it up and read out the array’s property.

Note that the didSelectRowAtIndexPath method of the table view can be completely empty for the data to be passed on. In fact, should you try an pass data in this method it won’t be available until the table is drawn.

Jay is the CEO and founder of WP Hosting, a boutique style managed WordPress hosting and support service. He has been working with Plesk since version 9 and is a qualified Parallels Automation Professional. In his spare time he likes to develop iOS apps and WordPress plugins, or draw on tablet devices. He blogs about his coding journey at and

Add your voice!