I have a sign in page and after I sign in, i want my program to pass a variable to a bunch of view controllers that are connected by SWRevealViewController. But I don't know how to.
This is the code I use to pass the variable "username" to the first page of SWRevealViewController points to
let next = self.storyboard?.instantiateViewControllerWithIdentifier("reveal") as! SWRevealViewController
next.loadView()
let main = next.frontViewController as! mainPage
main.username = username as String
self.presentViewController(next, animated: true, completion: nil)
I passed it through front view controller because mainPage is identified with sw_front. But I want to pass this variable to all the view controllers under the SWRevealViewController I have.
Additionally, the way I passed this variable does work but because I called "next.loadView()" first, the variable would not be assigned value in viewLoad of mainPage. Anybody has any idea how to solve this too? I was thinking one of the possibilities might be passing data to rearviewcontroller first and pass it around but I don't know how to