I am changing the RootViewController of SwRevealViewController
My code:
let next = self.storyboard?.instantiateViewController(withIdentifier: "SWRevealViewController") as! SWRevealViewController
next.loadView()
let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let viewController = mainStoryboard.instantiateViewController(withIdentifier: "MessageViewController") as! MessageViewController
UIApplication.shared.keyWindow?.rootViewController = viewController;
self.present(next, animated: true, completion: nil)
But I get this error:
>Presenting view controllers on detached view controllers is discouraged <ios.MesajDetayViewController: 0x7f8718d646f0>.
How to solve?