I have a layout as follows for iOS app development.

The layout contains following parts:
- Collapsing toolbar: This
viewshould work like in android i.e. on scrolling it must be collapsed. - Tab menu: This is tab menu. On swiping, the
tableviewmust be updated as per menu selected. Onscrollingtab menu must be fixed at top. - Tableview : This is simply a
tableviewcontains data as per menu selected in tab menu. - Bottom tab: This is
UITabbarMenu.
I tried with following approach:
I used Pagingkit library for tab menu. I created height of vProductList (parent view of tabbar and tableview) to height of device screen.
The problem appeared when tableview was inside scrollview. The problem was tableview and scrollview acts differently on scrolling. So to remove this I disable scrolling of tableview at first and enabled in viewDidScroll method on condition that the tab menu view is at (0,0) point of screen. But, one has to scroll twice to get the effect. This felt glitchy. How can I achieve smooth scrolling with this approach? Is there any library that can solve this problem?

This is how you can work this out.
View Hierarchy:
You can use a
UICollectionViewto create theTabbar. AUITableViewto handle the data when atabisselected. To handle the data in bothUICollectionViewandUITableView, create aViewModel. Here is an example of how you can,In the above code, I’ve created
enum ListTypethat identifies thetypes of tabsincollectionViewand the data that is to be presented in thetableView.class ViewModelthat handles thedataSourcefor bothcollectionViewandtableView.Let’s create a
UIViewControllerwith someoutlets, i.e.Add the methods for
UITableViewDataSourceUICollectionViewDataSourceandUICollectionViewDelegatemethodsTo handle the
collapsing viewontableViewscroll, implementscrollViewDidScroll(_:)method and handle thecollapse and expandbased on thelastContentOffsetof thetableView, i.e.