Native Shopify Mobile App with 20 new features
Kickstart your hyperlocal marketplace in Corona pandemic with a starter guide
Android App Development
iOS App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 126.96.36.199 release ready!
Owner and Founder. Opencart
Today, We will implement multilevel UITableview (like display categories list) in swift 5 without any third party. The items can be expanded and collapsed by tapping them. We create a basic design you can implement according to your requirement.
In this section, we implement tableview inside a UItableViewcell and the cell will be n level depth. Click here for more details about UITableview. And also we will manage the height of tableviewcell
Here we have used a JSON file for the data source and a specific structure so that we can easily manage it.
Swift version: 5
iOS version: 13
Step 1: Create a project from Xcode.
File ▸ New ▸ Project…. Choose the iOS ▸ Application ▸ Single View App template and create a new project.
Step 2: Add a UITableview inside the view controller and create Outlet. Here I will use a custom tableview class that helps to manage the height of the cell.
Step 3: Create a UItableViewCell for the tableView.
Step 4: Now parse the data which we will use in tableview. We have used some specific format of json shown in below.
Create a class to parse the data.
Now add the Delegate and Datasource of the tableview.
Step 5: Now create a model class which handles tableview delegate and datasource. We will use a common class for both tableview.
And the same model will use in UITableView. UITableViewCell code attached below.
Step 6: Now run the app in the simulator or a real device.
I hope this code will help you better to understand multilevel UITableview. If you feel any doubt or query please comment below.
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.