DomiDiDongo DomiDiDongo - 26 days ago 8
iOS Question

Passing Value while changing ViewController

I want to create a

array in one ViewController, but also use it in an different Viewcontroller, so I have to pass it.

I made my own class, which creates and holds this array, but how do I pass this class-instance when switching?

Answer Source

For passing value to one class to another there are many ways like

  • create a global variable
  • create a singleton class
  • NSUserDefault
  • Segue
  • Properties

As per your requirement use any one from it