Note: I am trying to solve this problem with swift, not objective c.
I am making an app the has 2 view controllers, one of the view controllers job is to deduct points from the variable, and the other view controllers job is to add points to that variable.
How can i make it that both view controllers share the same variable, or just constantly pass the variable between them?
Note, the 2 view controllers are connected with a tab bar controller, so i cant use a segue. I have tried using this code, but it does not work. Any Suggestions?
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
var destviewcontroller: prizesViewController = segue.destinationViewController as prizesViewController
//first other coins them mine
destviewcontroller.coins1 = coins2