Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

etimm

macrumors newbie
Original poster
Aug 28, 2014
1
0
I would like to know what the best way is to pass variables between classes.
I have one class named "storage" where I want to store variables

Code:
class storage {
var text: String
var location: String
}

I have two view controllers, one where the information comes from that I would like to store in the storage class and one where I would like to retrieve the data I've stored in class storage.

(I can't use segues because I'm not using use the storyboard)
 
Can't you just assign the variable to a property on the new ViewController when you instantiate it. You must be presenting the ViewController somehow...
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.