Overview on how App <> Views Communicate with eachother?

Hi all,

New to CIQ & native app programming (but not programming, mostly in C++ / Python), and this forum has been really helpful in getting off the ground. I'm new to developing in the App vs. View model, and i'm confused on how they communicate Data between. When my Application initalizes, I load some data into a custom Object i've developed (called a Zone). If I want to use this data to render different data in menus, layouts, etc, how do I make that available to those classes? Do I pass the Zone into the view as an arugment here:

    function getInitialView() {
    	
        return [ new GPS_APPView(), new GPS_APPDelegate() ];
    }

becomes:

function getInitialView() {
    	
        return [ new GPS_APPView(myZone), new GPS_APPDelegate(myZone) ];
    }

Thanks!

  • Yes.  You can just pass it.  Another approach (not the preferred) is to make "myZone" a global. I admit I've done that at times.

  • Thanks Jim. What about passing location update events to views? I currently start the GPS in the App's onStart method:

    Position.enableLocationEvents({:acquisitionType => Position.LOCATION_CONTINUOUS},method(:onPosition));

    i then defined a function "onPosition" but not sure how to propagate that updated Position.Info object into the view to update my data in my UI. In my above example, i'm creating a new view, but here I just want to update the currently displayed view.

    Am I starting GPS in the right spot? Would starting in the view be better? I originally avoided it so that if I build menus in the future as the user navigates its not causing GPS to start/stop etc.

    Thanks again for all the info!