I am building a survey app, where each button has a numerical value (count. I have 7 storyboards and I want the last storyboard to display the final count adding all the numerical values across all 7 stotyboards. I am not sure how to do this. is there a sample code by which I can pass this data from one storyboard to another?
Asked
Active
Viewed 26 times
1 Answers
2
You just need to manage a static variable. In one of the classes that you use, or in a new swift class (for eg, Control.swift), add static var count:Int = 0
.
Then, on your storyboards you can use Control.count += ...
, and the value is available in any part of your code. In the last storyboard, you just call again Control.count
and you have the value there.

FelipeCruzV10
- 426
- 6
- 13