How to design and code this in swift(IOS) AND Xcode.If we tap on down button it should display items and vice-versa like this:

How to design and code this in swift(IOS) AND Xcode.If we tap on down button it should display items and vice-versa like this:

You need a Collapsable TableView. In order to achieve that, in your TableView you must keep track of which sections are collapsed (contracted) and which of them are expanded. For this you need to maintain a set of indices of sections that are expanded, or a boolean array where the value of each index indicates if the corresponding section is expanded or not. Check for the values at the specific index while assigning height to a certain row. Check this link for more help.