send variables between views

Are there any other solution without store object and setProperty to send variables between views?
  • I wouldn't use the OS for this. The simplest way to do this is to make the variables global.
  • You can extract the state into an object, and then share this object between classes by giving them references to it. You can extend that solution even further and implement an observer pattern, where the views observe the program state and are notified when a change is made. This solution is cleaner, but will use up more memory than Jim's proposal.

    Travis
  • Travis is correct that what he says is cleaner, and in fact in my own code, I tend to do the first thing he mentioned. Some of it kind of depends on how much you want to share. If it's only a single var, I'll make it global. I think it's the primate sample where it shares a page number between the view and the delegate, and for something like that, I'd just use a global, for example.