Collapse tableView rows on a row select in swift

I

iMore Question

i have a tableView where i show user created circle name and i want when the user select a circle name rest circle name collapse and show only one circle name. but i don't know how to do that. please help help me guys.

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
{
if indexPath.section == 0
{
// here is the code to collapse the row
}
}
Section == 0 have the rows of circle names.