How can I use a variable in another ViewController?

Hi! I am creating a quiz. I need a variable for the number of questions the user chooses. I have linked the buttons that allow this to a ViewController. How can I make sure that I can use that variable in another ViewController (where the code is written for the questions)?

If you’re storing questions in an array, the number of questions could be implied by the size of the array. Here is an example of that: https://github.com/vermont42/Conjugar/blob/master/Conjugar/Quiz.swift#L20

An instance of Quiz may be shared among view controllers.

Terms of Service

Privacy Policy

Cookie Policy