I currently have a method that I use to setup a new ViewController
func setRootView(viewController vc: UIViewController){
UIApplication.shared.windows.first?.rootViewController = vc
UIApplication.shared.windows.first?.makeKeyAndVisible()
}
How can I modify the presentation that the ViewController will show over the other screen like presentation style not modally ?
That is the function that gets called after the button is pressed and the view should change:
func moveToNextVC(isLogin: Bool){
if self.checkNetworkConnection(){
let vc = HomeVC(nibName: "HomeVC", bundle: nil)
if isLogin{
vc.modalPresentationStyle = .automatic
vc.url = loginLink
}else{
vc.modalPresentationStyle = .automatic
vc.url = signupLink
}
setRootView(viewController: vc)
}
else{
showAlert("Alert!", message: "Please check your internet connection, then try again.")
}
}
CodePudding user response:
Instead of doing this
UIApplication.shared.windows.first?.rootViewController = vc
, I would dopresent(vc, animated: true)
This solved the problem.