While presenting a view controller XCode warns me :
Presenting view controllers on detached view controllers is discouraged
Why it is happening?
While presenting a view controller XCode warns me :
Presenting view controllers on detached view controllers is discouraged
Why it is happening?
It happens when you present a UIViewcontroller on viewDidLoad()
because till then the view is not loaded and you are presenting a new UIViewcontroller there.
Try to present another view/UIviewcontroller after viewDidAppear() or inside if required. or just to remove warning you can use:
self.view.window?.rootViewController?.presentViewController("vc to present", animated: true, completion: nil)