InteractiveSideMenu icon indicating copy to clipboard operation
InteractiveSideMenu copied to clipboard

What does `SideMenuItemContent` do?

Open Jeehut opened this issue 7 years ago • 1 comments

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()
    }
}

Jeehut avatar Aug 30 '17 12:08 Jeehut

@Dschee Talking about SideMenuItemContent, currently, it's used to get access to showSideMenu() from item menu VC since the protocol has a default implementation.

MenuHelper is a good idea that can provide convenient API. Feel free to contribute this project and send pull requests.

Thanks for using the library and asking questions.

AndreyArzhannikov avatar Aug 31 '17 06:08 AndreyArzhannikov