Skip to content

What does SideMenuItemContent do? #40

Open
@Jeehut

Description

@Jeehut

Really, again when starting to use this library in my app I can't see why I need to conform to the SideMenuItemContent protocol im my view controllers? Is it only a hint so people don't forget they have to call showSideMenu() somewhere? Cause I can't find how view controllers that conform to that protocol are used within this library ... if it's only a reminder, why not solve it via docs?

I mean you could simplify the library and the docs again by simply saying: If you want to show the side bar, simply call showSideMenu(). The one thing that would really help would be some kind of helper which allows access to the method from everywhere like the following (which is actually a helper I have written so I don't have to mess with all the stuff in different files but use one file with a quite understandable API instead):

import UIKit
import InteractiveSideMenu

class MenuHelper {
    // MARK: - Stored Type Properties
    static let shared = MenuHelper()

    // MARK: - Stored Instance Properties
    let menuViewCtrl = MenuContainerViewController()

    // MARK: - Instance Methods
    func setMenuViewController(_ menuViewController: MenuViewController) {
        menuViewCtrl.menuViewController = menuViewController
    }

    func showContentViewController(_ contentViewController: UIViewController) {
        menuViewCtrl.selectContentViewController(contentViewController)
    }

    func openMenu() {
        menuViewCtrl.showSideMenu()
    }

    func closeMenu() {
        menuViewCtrl.hideSideMenu()
    }
}

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions