SideMenuController

open class SideMenuController : UIViewController

A container view controller owns a menu view controller and a content view controller.

The overall architecture of SideMenuController is: SideMenuController ├── Menu View Controller └── Content View Controller

  • Configure this property to change the behavior of SideMenuController;

    Declaration

    Swift

    public static var preferences: SideMenuController.Preferences
  • The identifier of content view controller segue. If the SideMenuController instance is initiated from IB, this identifier will be used to retrieve the content view controller.

    Declaration

    Swift

    @IBInspectable
    public var contentSegueID: String
  • The identifier of menu view controller segue. If the SideMenuController instance is initiated from IB, this identifier will be used to retrieve the menu view controller.

    Declaration

    Swift

    @IBInspectable
    public var menuSegueID: String
  • The side menu controller’s delegate object.

    Declaration

    Swift

    public weak var delegate: SideMenuControllerDelegate?
  • Undocumented

    Declaration

    Swift

    open var contentViewController: UIViewController! { get set }
  • Undocumented

    Declaration

    Swift

    open var menuViewController: UIViewController! { get set }
  • Return true if the menu is now revealing.

    Declaration

    Swift

    open var isMenuRevealed: Bool
  • Creates a SideMenuController instance with the content view controller and menu view controller.

    Declaration

    Swift

    public convenience init(contentViewController: UIViewController, menuViewController: UIViewController)

    Parameters

    contentViewController

    the content view controller

    menuViewController

    the menu view controller

  • Reveals the menu.

    Declaration

    Swift

    open func revealMenu(animated: Bool = true, completion: ((Bool) -> Void)? = nil)

    Parameters

    animated

    If set to true, the process will be animated. The default is true.

    completion

    Completion closure that will be executed after revealing the menu.

  • Hides the menu.

    Declaration

    Swift

    open func hideMenu(animated: Bool = true, completion: ((Bool) -> Void)? = nil)

    Parameters

    animated

    If set to true, the process will be animated. The default is true.

    completion

    Completion closure that will be executed after hiding the menu.

  • Caches the closure that generate the view controller with identifier.

    It’s useful when you want to configure the caching relation without instantiating the view controller immediately.

    Declaration

    Swift

    open func cache(viewControllerGenerator: @escaping () -> UIViewController?, with identifier: String)

    Parameters

    viewControllerGenerator

    The closure that generate the view controller. It will only executed when needed.

    identifier

    Identifier used to change content view controller

  • Caches the view controller with identifier.

    Declaration

    Swift

    open func cache(viewController: UIViewController, with identifier: String)

    Parameters

    viewController

    the view controller to cache

    identifier

    the identifier

  • Changes the content view controller to the cached one with given identifier.

    Declaration

    Swift

    open func setContentViewController(with identifier: String,
                                       animated: Bool = false,
                                       completion: (() -> Void)? = nil)

    Parameters

    identifier

    the identifier that associates with a cache view controller or generator.

  • Undocumented

    Declaration

    Swift

    open func setContentViewController(to viewController: UIViewController,
                                       animated: Bool = false,
                                       completion: (() -> Void)? = nil)
  • Return the identifier of current content view controller.

    Declaration

    Swift

    open func currentCacheIdentifier() -> String?

    Return Value

    if not exist, returns nil.

  • Clears cached view controller or generators with identifier.

    Declaration

    Swift

    open func clearCache(with identifier: String)

    Parameters

    identifier

    the identifier that associates with a cache view controller or generator.