One of my work had a requirement to have an accordion view but having multiple levels of expansion and collapse of cells like you open/ close your directory structure.
I did a sample on that, I was able to achieve the desired result. The basic concept is the same, I am using the deleteRowsAtIndexPath and insertRowsAtIndex path only but by creating a model object which has a parent children relationship and loading the children into the main array whenever the parent is tapped. I am not good at putting a tutorial so I am sharing my sample code, hope it helps someone.
Code here Accordion_git
Updated
Did a SWIFT version of this, not sure whether optimal but it works.
Code here Accordion_SWIFT