ekazaev / route-composer

Protocol oriented, Cocoa UI abstractions based library that helps to handle view controllers composition, navigation and deep linking tasks in the iOS application. Can be used as the universal replacement for the Coordinator pattern.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to display a modal sheet from a tab bar item

vykut opened this issue · comments

How should one present a screen modally from one of the items in the tab bar?
Similar to how LinkedIn has the "post" button in the middle of the tab bar that modally presents a screen for post creation.

I wonder if the authors of this library have already added support for this rather common usecase for tab bars. Normally, this would be implemented via the delegate of the UITabBarController, and specifying delegates is already supported by this library via the TabBarControllerFactory.

Thank you

@vykut Hi

Thank you for your question. Route composer covers the navigation/deeplinking and view controllers contruction in an appropriate matter. What you ask it seems is about how to trigger such navigation. Yes - probably the right way to go is to use a UITabBarControllerDelegate so that if user taps on, lets say, third tab - instead of default UITabBarController behaviour you can trigger presentation of modal view controller. You may use or not the routecomposer to present it. Using view controller will give you a benefit that if somewhere else in your app there is another button that triggers the same navigation - you can just call it again, route composer will/can close other modal windows if they are presented and this moment and so on. Same applies to deep-linking outside of the app. Like if you might have in teh future a depplinkik from an email to open a modal to create a new post. But to summarise all above - the routecomposer builds view controllers for you. What triggers it - should be handled in the app according to your business needs.