I have a problem in my AppDelegate function didFinishLaunchingWithOptions
I use the SnapSwipeView https://github.com/jakespracher/Snapchat-Swipe-View to control my 'Camera' ViewControler in my AppDelegate
and the if statement to know if the user is already logged in Parse.
So here is my function :
let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
var initialViewController: UIViewController
let left = storyboard.instantiateViewController(withIdentifier: "left")
let middle = storyboard.instantiateViewController(withIdentifier: "Camera")
let right = storyboard.instantiateViewController(withIdentifier: "right")
let top = storyboard.instantiateViewController(withIdentifier: "top")
let bottom = storyboard.instantiateViewController(withIdentifier: "bottom")
let snapContainer = SnapContainerViewController.containerViewWith(left,
middleVC: middle,
rightVC: right,
topVC: top,
bottomVC: bottom)
self.window?.rootViewController = snapContainer
Which work fine if I only run this rootViewController=snapContainer
, but if I add this if statement :
if let user = user {
print("logged")
initialViewController = storyboard.instantiateViewController(withIdentifier: "Camera") as! UIViewController
} else {
print("not logged")
initialViewController = storyboard.instantiateViewController(withIdentifier: "IntroMain") as! VideoSplashViewController
}
self.window?.rootViewController = initialViewController
})
If my user isn't logged, it goes correctly to my IntroMain, but once he is logged/signup, the snapContainer isn't working because it hasn't been launched as rootViewController
Anyone knows how I can fix this?
Many thanks,