You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the tab bar controller of one of our apps, we've implemented tabBarController(_:, shouldSelect:) to prevent some view controllers from getting selected. However, the swipe gesture still allows to select them.
So deriving the index of the next view controller to select should take this into account.
Unfortunately, we also need to execute code during tabBarController(_:, shouldSelect:) that should not be executed during the swipe check. This is because we want to detect a top onto the tab bar item without switching to it and AFAIK the only way to achieve that is to override tabBarController(_:, shouldSelect:).
So I propose to introduce a method func swipeableTabBarController(_ tabBarController: SwipeableTabBarController, shouldSelectInteractively viewController: UIViewController) -> Bool which is called during the swiping check. Its default implementation just asks delegate?.tabBarController?(tabBarController, shouldSelect: viewController) but subclasses may override it to do a different decision that with tapping.
The text was updated successfully, but these errors were encountered:
@DarkDust I really hate to decline user's proposals but this is a specific requirement for your app/product and I don't think others will be benefited from the increased complexity to support this.
Anyway, this library will rarely get new features/changes. #73 is the only critical fix that comes to mind, so it's fine to use your fork with your specific requirements.
No problem. I still think tabBarController(_:, shouldSelect:) should be respected, but I agree that my solution is introducing a feature very few (if any) users would need.
I'm going to close this issue and the related PR for the moment. If we find that this is a use case for other library users we can reevaluate it. Thanks for the work!
In the tab bar controller of one of our apps, we've implemented
tabBarController(_:, shouldSelect:)
to prevent some view controllers from getting selected. However, the swipe gesture still allows to select them.So deriving the index of the next view controller to select should take this into account.
Unfortunately, we also need to execute code during
tabBarController(_:, shouldSelect:)
that should not be executed during the swipe check. This is because we want to detect a top onto the tab bar item without switching to it and AFAIK the only way to achieve that is to overridetabBarController(_:, shouldSelect:)
.So I propose to introduce a method
func swipeableTabBarController(_ tabBarController: SwipeableTabBarController, shouldSelectInteractively viewController: UIViewController) -> Bool
which is called during the swiping check. Its default implementation just asksdelegate?.tabBarController?(tabBarController, shouldSelect: viewController)
but subclasses may override it to do a different decision that with tapping.The text was updated successfully, but these errors were encountered: