Created
          May 30, 2020 07:56 
        
      - 
      
- 
        Save aqubi/ac66ac5d51cf7560d6eca97ab0e354be to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool { | |
| if tabBarController.selectedViewController == viewController, let split = viewController as? UISplitViewController { | |
| if split.isCollapsed { | |
| if let navigation = split.viewControllers.first as? UINavigationController { | |
| navigation.popToRootViewController(animated: true) | |
| } | |
| } else if split.displayMode == .primaryHidden { | |
| let mode = split.preferredDisplayMode | |
| split.preferredDisplayMode = mode | |
| } | |
| } | |
| return true | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment