Read More
Read now

Create expandable table view in Swift


Expandable UITableView with Animation

Expandable is very useful in an iOS application and To create it we follow the MVVM structure. First, create three classes ExpandableModal, ExpandableViewModal, ExpandableController .ExpandableController is of ViewController’s subclass, ExpandableModal, and  ExpandableViewModal.

To start creating first you know is your table view’s states is collapsible or not. and there you know the current state of your section i.e. isCollapsed or not.

After that, we need to create the custom header view that will contain title and image(will indicate us that the view state).Create a Xib of subclass  UITableViewHeaderFooterView

Then create  ExpandableModal that will contain the header data and subheader data (Your child nodes)

After that set your all data in your header

Create a reload function in your view controller which is directly bound with your view modal

Create your ExpandableViewModal and present your all data:-

So when you get all data just reload your table view categoryTableView.reloadData()


So you have successfully added an Expandable TableView in your app.

Thanks for go through this blog. Stay cool and stay updated.

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


  • Nagaraju Kunisetty
    Can u please provide me the Project Git Hub link Please
    • bhavuk chawla (Moderator)
      we didn’t upload any project to git if you need any help you can ask
  • Twinkal Ginoya
    Can you please provide CategoryMenuModel ?
  • css.php

    Big thanks to Webkul and his team for helping get Opencart release ready!

    Deniel Kerr

    Owner and Founder. Opencart

    Talk to Sales
    Start a Project

      Message Sent!

      If you have more details or questions, you can reply to the received confirmation email.

      Back to Home