As this reply is too long to put it in the comment textField:
I used this techniques in one of my apps.
In AppDelegate write this method for example:
func buildUserInterface(){
let objectID:String? = NSUserDefaults.standardUserDefaults().stringForKey("user_id")
if objectID != nil {
let mainStoryBoard:UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let singleMode:singleModeVC = mainStoryBoard.instantiateViewControllerWithIdentifier("singleModeVC") as! singleModeVC
let mainPageNav = UINavigationController(rootViewController: singleMode)
let appDelegate:AppDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
appDelegate.window?.rootViewController = mainPageNav
}
}
It can therefore only be used, when you got a user logged in or just created.
In the ViewController handling the regristration/loggin in within the Login Block put this:
if PFUser.currentUser() != nil {
objectID = PFUser.currentUser()?.objectId
NSUserDefaults.standardUserDefaults().setObject(objectID, forKey: "user_id")
NSUserDefaults.standardUserDefaults().synchronize()
// singleModeVC
let mainStoryBoard:UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let singleMode:singleModeVC = mainStoryBoard.instantiateViewControllerWithIdentifier("singleModeVC") as! singleModeVC
let mainPageNav = UINavigationController(rootViewController: singleMode)
let appDelegate:AppDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
appDelegate.window?.rootViewController = mainPageNav
singleModeVC is the name and class of my view controller to appear after signing in. Hope it helps.