SideMenuController
open class SideMenuController : UIViewController
extension SideMenuController: UIGestureRecognizerDelegate
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
-
Undocumented
Declaration
Swift
open override func viewDidLoad()
-
Undocumented
Declaration
Swift
open override func prepare(for segue: UIStoryboardSegue, sender: Any?)
-
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.
-
Undocumented
Declaration
Swift
open override var childForStatusBarStyle: UIViewController? { get }
-
Undocumented
Declaration
Swift
open override var childForStatusBarHidden: UIViewController? { get }
-
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.
animated
whether the transition should be animated, default is
false
.completion
the completion closure will be called when the transition complete. Notice that if the caller is the current content view controller, once the transition completed, the caller will be removed from the parent view controller, and it will have no access to the side menu controller via
sideMenuController
-
Change the content view controller to
viewController
Declaration
Swift
open func setContentViewController(to viewController: UIViewController, animated: Bool = false, completion: (() -> Void)? = nil)
Parameters
viewController
the view controller which will become the content view controller
animated
whether the transition should be animated, default is
false
.completion
the completion closure will be called when the transition complete. Notice that if the caller is the current content view controller, once the transition completed, the caller will be removed from the parent view
-
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.
-
Undocumented
Declaration
Swift
open override var shouldAutorotate: Bool { get }
-
Undocumented
Declaration
Swift
open override var supportedInterfaceOrientations: UIInterfaceOrientationMask { get }
-
Undocumented
Declaration
Swift
open override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator)
-
The preferences of side menu controller.
See moreDeclaration
Swift
public struct Preferences
-
Undocumented
Declaration
Swift
public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool
-
Undocumented
Declaration
Swift
public func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool