I found this example useful. Hope it helps.

https://forum.omz-software.com/topic/1524/simple-demo-of-tableview-logic-for-the-novices