`Beginning the undertaking, I needed to be neat when it got here to having the views, so I made a storyBoard the place I’ve my LogIn view and a StoryBoard that has a house, that’s, I do not work with a Fundamental as a storyBoard.
Once I begin the applying from the sceneDelegate I can know if I’m logged in or not since I saved the corresponding flag in my UserDefaults, so that is how I create a storyBoard or one other with its respective UIViewController.
My downside is after I do the LogIn per se, since at that time I wish to redirect to the homeStoryBoard, which makes use of the HomeUIViewController.
By having these views organized individually, I’m not discovering a approach to go to that view with out the potential of returning to logIn, since I’ve already logged in.
The best way I discovered, raises the view from dwelling as if it had been a popUp however that will not be working for me.
I got here to make a brand new undertaking the place I used a single storyBoard Fundamental and have my views there however with this answer the issue I see is that the “Again” button is generated that will make me return from Residence to LogIn and that will not assist me both.
I made the following code in mi sceneDelegate…
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, choices connectionOptions: UIScene.ConnectionOptions) {
if let _ = UserDefaults.normal.string(forKey: kIsLogged) {
print("I am loggin")
guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow(body: windowScene.coordinateSpace.bounds)
window?.windowScene = windowScene
window?.makeKeyAndVisible()
let storyboard = UIStoryboard(identify: "ServiceHomeViewStoryBoard", bundle: nil)
window?.rootViewController = storyboard.instantiateViewController(withIdentifier: "SB_ServiceHome")
} else {
print("I am not loggin")
guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow(body: windowScene.coordinateSpace.bounds)
window?.windowScene = windowScene
window?.makeKeyAndVisible()
let storyboard = UIStoryboard(identify: "LogIn", bundle: nil)
window?.rootViewController = storyboard.instantiateViewController(withIdentifier: "LogInStoryBoard")
}
}
In my LooginViewController I made after logIn operate success…
let storyBoard = UIStoryboard(identify: "ServiceHomeViewStoryBoard", bundle: nil)
let serviceHomeViewController = storyBoard.instantiateViewController(withIdentifier: "SB_ServiceHome")
self.navigationController?.pushViewController(serviceHomeViewController, animated: true)
self.navigationController?.current(serviceHomeViewController, animated: true)
self.current(serviceHomeViewController, animated:true, completion:nil)