evnaz / ENSwiftSideMenu

A simple side menu for iOS written in Swift.
MIT License
1.82k stars 282 forks source link

ENSwiftSideMenu doesnt support splitViewController #134

Open iceman201 opened 8 years ago

iceman201 commented 8 years ago
internal func topMostController () -> ENSideMenuProtocol? {
        var topController : UIViewController? = UIApplication.sharedApplication().keyWindow?.rootViewController
        if (topController is UITabBarController) {
            topController = (topController as! UITabBarController).selectedViewController
        }
        var lastMenuProtocol : ENSideMenuProtocol?
        while (topController?.presentedViewController != nil) {
            if(topController?.presentedViewController is ENSideMenuProtocol) {
                lastMenuProtocol = topController?.presentedViewController as? ENSideMenuProtocol
            }
            topController = topController?.presentedViewController
        }

        if (lastMenuProtocol != nil) {
            return lastMenuProtocol
        }
        else {
            return topController as? ENSideMenuProtocol
        }
    }