Swift storyboard cross dissolve transition flashes different view controller

368 Views Asked by At

I am creating an app with cross dissolve transitions. The issue occurs when a view controller is presented and a previous screen flashes for a split second every time a cross dissolve transition happens until the app is forced closed and restarted. A lot of the view controllers are displayed in 4 different ways using the code listed below. Some are changed using a button from one view controller linked to another view controller with using storyboard's "show" or "show detail" which is not included in the code below. Thanks for any help in advance!

Code:

METHOD 1

DispatchQueue.main.async {
    let vc = self.storyboard?.instantiateViewController(withIdentifier: "ViewController") as! ViewController
    self.present(vc, animated: true, completion: nil)
}

METHOD 2

    DispatchQueue.main.async { self.navigationController?.popViewController(animated: true)
        let storyboard = UIStoryboard(name: "Main", bundle: nil)
        let alert = storyboard.instantiateViewController(withIdentifier: "Alerts")
        alert.modalPresentationStyle = UIModalPresentationStyle.overCurrentContext
        alert.modalTransitionStyle = UIModalTransitionStyle.crossDissolve
        self.present(alert, animated: true, completion: nil)
    }
0

There are 0 best solutions below