dps

DPSlideMenuKit

Slide menu kit with left and right pages. Just like Slack!

Showing:

Popularity

Downloads/wk

0

GitHub Stars

71

Maintenance

Last Commit

1yr ago

Contributors

0

Package

Dependencies

0

License

MIT

Categories

Readme

DPSlideMenuKit-Swift

Slide menu kit with left and right pages. Just like Slack!

Cocoapods Pod License Swift-5.2.4 Carthage Compatible

alt text

View Controllers Hierarchy

alt text

Usage

  // 1. IF embed in storyboard
  override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    if let destination = segue.destination as? DPDrawerViewController,
      segue.identifier == "Main_Drawer" {
      DPSlideMenuManager.shared.setDrawer(drawer: destination)
    }
  }
alt text
  override func viewDidLoad() {
    super.viewDidLoad()
    
    // 2. IF NOT embed in storyboard, set drawer manually
    //    let drawer = DPDrawerViewController()
    //    addChild(drawer)
    //    view.addSubview(drawer.view)
    //    DPSlideMenuManager.shared.setDrawer(drawer: drawer)
    
    // 3. Add view controllers in the left & right side, which shall be inherited from DPBaseEmbedViewController

    // Tips: If the viewcontroller is not generated from storyboard, set the storyboard param to nil,
    //    let leftMenuVCTypes = [DPTestViewController.self]
    //    let leftMenuViewControllers = UIViewController.baseEmbedControllers(leftMenuVCTypes, storyboard: nil)

    // 4. Center viewcontroller shall be inherited from DPCenterContentViewController, which also can not be nil
    let leftMenuVCTypes = [DPTeamViewController.self,
                           DPChannelListViewController.self,
                           DPMessageListViewController.self]
    let rightMenuVCTypes = [DPSettingsViewController.self]

    guard let leftMenuViewControllers =
      UIViewController.viewControllers(leftMenuVCTypes,
                                       storyboard: "Pages") as? [DPBaseEmbedViewController],
    let rightMenuViewControllers =
      UIViewController.viewControllers(rightMenuVCTypes,
                                       storyboard: "Pages") as? [DPBaseEmbedViewController],
    let homeViewController =
      UIViewController.viewController(DPHomeViewController.self,
                                      storyboard: "Pages") as? DPHomeViewController else {
      return
    }

    // 5. Combine center, left, right, together. Meanwhile, left or right can be nil
    DPSlideMenuManager.shared.setup(homeViewController,
                                    leftContentEmbedViewControllers: leftMenuViewControllers,
                                    rightContentEmbedViewControllers: rightMenuViewControllers)
  }

  // 6. Pass status bar hide/show delegate to drawer, let drawer manager the logic
  open override var childForStatusBarHidden: UIViewController? {
    return DPSlideMenuManager.shared.drawer
  }

  public override var preferredStatusBarStyle: UIStatusBarStyle {
    return .lightContent
  }

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100