iOS 14 DispatchQueue.main.async not working

I have this code that was working perfectly and when I updated to ios 14 it stopped working.

Debugging the app I noticed that the code inside the closure was not working.

func replaceWindowRootWith(flow: Flow, step: Step, fadeAnimation: Bool = true, addDelay: Bool = false) -> FlowContributors {
    Flows.whenReady(flow1: flow) { [weak self] root in
        root.hero.isEnabled = true
        root.hero.modalAnimationType = fadeAnimation ? .fade : .none
        if let currentRoot = self?.window?.rootViewController {
            let delay = addDelay ? 0.2 : 0
            DispatchQueue.main.asyncAfter(deadline: .now() + delay) {
                print("REPLACING - \(step.self)")
                Hero.shared.cancel(animate: false)
                currentRoot.hero.replaceViewController(with: root)
        } else {
            self?.window?.rootViewController = root
    return .one(flowContributor: .contribute(withNextPresentable: flow,
                                             withNextStepper: OneStepper(withSingleStep: step)))

The code inside the DispatchQueue closure doesn’t run. Anyone had the same problem or found a solution to this yet?

Hi @Taiwa,

sorry but we are a french-speaking community and we cannot help you in english.
I suggest you try and post your question on stackoverflow ; you’ll probably get some hits with english speaking people.

Have a good day.