Struggling a couple of days with this...
I have set a rootVC
from AppDelegate
in didFinishLaunchingWithOptions
and this is working fine.
Now from that rootVC
I want that, if some condition is met, eg. if x=y
a new rootVC
is set and displayed.
I stack overflowed long long time, found different solutions, but none is working.
The below is compiling, and executing, I checked with breakpoint, but nothing shows up in the app.
animated Bool false
self Regional2.IrelandViewController 0x0000000102b0ff30
newViewController Regional2.IrelandMain 0x0000000102d0d300
customViewControllersArray NSArray 0x00000001c000b620
ObjectiveC.NSObject NSObject
Exception State Registers
far unsigned long 0x00000001b0a7ba78
esr unsigned int 0x92000007
exception unsigned int 0x00000000
Floating Point Registers
General Purpose Registers
and the piece of the code . . .
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
let newViewController = self.storyboard?.instantiateViewController(withIdentifier: "IrelandMain") as! IrelandMain
let customViewControllersArray : NSArray = [newViewController]
self.navigationController?.viewControllers = customViewControllersArray as! [UIViewController]
self.navigationController?.pushViewController(newViewController, animated: true)
}
Please notice that navigationController
show produces the same output. Nothing changes.