handsomecode / InteractiveSideMenu

iOS Interactive Side Menu written in Swift.
Apache License 2.0
708 stars 164 forks source link

Delay on SideMenuItemContent #92

Open hakankoluacik opened 6 years ago

hakankoluacik commented 6 years ago

Sometimes when i tap an item from the menu, viewcontroller comes after 4-5 second delay i don't have any idea why. Sometomes comes fast.

lmr001 commented 6 years ago

I have experienced the same delay. The following fixed it for me. Change made to MenuContainerViewController.swift

    /**
     Presents left side menu.
     */
    func presentNavigationMenu() {
        if menuViewController == nil {
            fatalError("Invalid 'menuViewController' value. It should not be nil")
        }
        DispatchQueue.main.async { [weak self] in
            guard let menuViewController = self?.menuViewController else { return }
            self?.present(menuViewController, animated: true, completion: nil)
        }
        isShown = true
    }

    /**
     Dismisses left side menu.
     */
    func dismissNavigationMenu() {
        DispatchQueue.main.async { [weak self] in
            self?.dismiss(animated: true, completion: nil)
        }
        isShown = false
    }