teodorpatras/SideMenuController

Topcontroller

elgartoinf opened this issue · 1 comments

Regards!!!
How i get the topcontroller using this library?

these are my solution
import Foundation
import SideMenuController

class CustomSideMenuViewController: SideMenuController {

override func viewDidLoad() {
    super.viewDidLoad()
    performSegue(withIdentifier: "showController", sender: nil)
    performSegue(withIdentifier: "containSideMenu", sender: nil)
}
required init?(coder aDecoder: NSCoder) {
    SideMenuController.preferences.drawing.menuButtonImage = UIImage(named: "menu")
    SideMenuController.preferences.drawing.sidePanelPosition = .underCenterPanelLeft
    SideMenuController.preferences.drawing.sidePanelWidth = 300
    SideMenuController.preferences.animating.transitionAnimator = FadeAnimator.self
    SideMenuController.preferences.drawing.centerPanelOverlayColor = UIColor.darkGray
    SideMenuController.preferences.drawing.centerPanelShadow = true
    SideMenuController.preferences.animating.statusBarBehaviour = .showUnderlay
    super.init(coder: aDecoder)
}
in appdelegate i call this funcion that return the top controller
func currentController()->UIViewController{
    return ((self.centerViewController as? UINavigationController)?.topViewController as! UIViewController)
 }
 }