types of variables: global, application, session or cookies variables in swift?

Hello,


I have an "x" viewController which when I press a button, the view is reload and the data is updated in the same view with new values but when the view is reload, miss i the old values (this can happen several times) and also i must save this data in any array and then send them all together in the last step. When i press the button i use to reload the view:

self.navigationController!.pushViewController(self.storyboard!.instantiateViewControllerWithIdentifier("mvx_id") as! xController, xd: true)

I don't know how I can save this data and don't get lost when I update the view, what I can use?

Before you replace the view controller with a completely new copy (from instantiateViewControllerWithIdentifier:), you would need to save the data from the old one first to another object that you aren't throwing away like the navigation controller (or keep a reference to the old view controller(s) in a similar place, so that you can access it later).


A better solution might be to write the code you need in the "x" view controller class to save and reload the data without having to create a new copy, so that it isn't being replaced with a new view controller.

types of variables: global, application, session or cookies variables in swift?
 
 
Q