Perform Segue in ViewDidLoad [duplicate] Perform Segue in ViewDidLoad [duplicate] xcode xcode

Perform Segue in ViewDidLoad [duplicate]


You can't use performSegue() from within viewDidLoad(). Move it to viewDidAppear().

At viewDidLoad() time, the current view isn't even attached to the window yet, so it's not possible to segue yet.


You can also use a different approach - change the main window's rootViewController to the view controller of your choice depending on isFirstLaunchboolean

UIApplication.shared.keyWindow?.rootViewController = setPasswordViewController