I am trying to send the jsonData of the user as soon as he logged in to the next view controller and display some details in it. But I am unable to pass that jsonData. If I declare a global var in the firstViewController, I can pass it to secondViewController.
But I am declaring my let jsonData inside a condition and I am unable to send it. I tried retrieving all the details of json in global and share it in the secondViewController. But I can't as it can only retrieved inside the condition.
let jsonData:NSDictionary = NSJSONSerialization.JSONObjectWithData(urlData!, options:NSJSONReadingOptions.MutableContainers , error: &error) as NSDictionary
let jsonArray: AnyObject! = jsonData.valueForKey("user")
NSLog("jsonddata = \(jsonArray)")
if (segue.identifier == "login_success") {
var svc = segue.destinationViewController as welcomeViewController;
svc.userNameText = userNameText.text
svc.jsonArray = jsonArray