def splitViewController(svc, willChangeToDisplayMode: display_mode)
      vc = svc.viewControllers.first
      vc = vc.topViewController if vc.respond_to?(:topViewController)
      case display_mode
      # when UISplitViewControllerDisplayModeAutomatic then do_something?
      when UISplitViewControllerDisplayModePrimaryHidden
        self.splitViewController(svc, willHideViewController: vc, withBarButtonItem: nil, forPopoverController: nil)
        # TODO: Add `self.master_screen.try(:will_hide_split_screen)` or similar?
      when UISplitViewControllerDisplayModeAllVisible
        self.splitViewController(svc, willShowViewController: vc, invalidatingBarButtonItem: nil)
        # TODO: Add `self.master_screen.try(:will_show_split_screen)` or similar?
      # when UISplitViewControllerDisplayModePrimaryOverlay
        # TODO: Add `self.master_screen.try(:will_show_split_screen_overlay)` or similar?
      end
    end
def splitViewController(svc, willChangeToDisplayMode: display_mode)
      vc = svc.viewControllers.first
      vc = vc.topViewController if vc.respond_to?(:topViewController)
      case display_mode
      # when UISplitViewControllerDisplayModeAutomatic then do_something?
      when UISplitViewControllerDisplayModePrimaryHidden
        self.splitViewController(svc, willHideViewController: vc, withBarButtonItem: nil, forPopoverController: nil)
        # TODO: Add `self.master_screen.try(:will_hide_split_screen)` or similar?
      when UISplitViewControllerDisplayModeAllVisible
        self.splitViewController(svc, willShowViewController: vc, invalidatingBarButtonItem: nil)
        # TODO: Add `self.master_screen.try(:will_show_split_screen)` or similar?
      # when UISplitViewControllerDisplayModePrimaryOverlay
        # TODO: Add `self.master_screen.try(:will_show_split_screen_overlay)` or similar?
      end
    end
iOS 8 and above