From 8e1af5d1f39db4e494507a80032f2fb815939674 Mon Sep 17 00:00:00 2001 From: Adrian Mayoral Date: Sun, 7 Jul 2019 19:47:16 -0400 Subject: [PATCH] #95 - fixed the delay when side menu needed to close --- Sources/MenuContainerViewController.swift | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Sources/MenuContainerViewController.swift b/Sources/MenuContainerViewController.swift index 1db85c8..a9ee84c 100644 --- a/Sources/MenuContainerViewController.swift +++ b/Sources/MenuContainerViewController.swift @@ -177,7 +177,10 @@ fileprivate extension MenuContainerViewController { if menuViewController == nil { fatalError("Invalid `menuViewController` value. It should not be nil") } - present(menuViewController, animated: true, completion: nil) + DispatchQueue.main.async { [weak self] in + guard let menuViewController = self?.menuViewController else { return } + self?.present(menuViewController, animated: true, completion: nil) + } isShown = true } @@ -185,7 +188,9 @@ fileprivate extension MenuContainerViewController { Dismisses left side menu. */ func dismissNavigationMenu() { - self.dismiss(animated: true, completion: nil) + DispatchQueue.main.async { [weak self] in + self?.dismiss(animated: true, completion: nil) + } isShown = false } }