ios - how to pass jsonData to other ViewController in Swift? -


I am trying to log the user's json data as soon as the next view controller and some details. But I am unable to pass that JSData. If I declare a global variable in the first ViewController, then I can pass it in another viewer. But I am declaring JSDTDa to go inside a condition and I am unable to send it. I tried to retrieve all the details of Jasonson at the global level and shared it in another viewer. But I can not because it can only be achieved within the situation.

Any help is appreciated

  jsonData: NSDictionary = NSJSONSerialization.JSONObjectWithData (urlData !, Option: NSJSONReadingOptions.MutableContainers, Error: and Error) Come on NSDictionary jsonArray: AnyObject! = JsonData.valueForKey ("user") NSLog ("jsonddata = \ (jsonArray)") if (segue.identifier == "login_success") {var svc = segue.destinationViewController welcome view controller; Svc.userNameText = userNameText.text svc.jsonArray = jsonArray    

Try this way

  override func readyForSegue (segue: UIStoryboardSegue !, sender: AnyObject!) {If (segue.identifier == "login_success") {var svc = segue! SecondViewController as .destinationViewController; Svc.toPass = textField.text}}    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -