Major issue with tab bar - no data passing allowed

Can you tell me how to pass data to screens inside of a tab bar?

What is happening is i have a datasource running on my home screens (and others) and there is a lag when you go into the screen because it has to take time to make the API call. I would like to push the API call to my “onboarding” screen so that all of the api calls are done and the data is downloaded, and then whenever you go to the respective screens its populated by didSet…etc. I don’t see how this is possible in Kodika?

I tried a singleton and a new and still doesn’t work. Because I am downloading JSON from my API calls and putting into a model, you do not have any options in Kodika to save “models” or “Lists of Models” in UserDefaults.

I know in Swift/XCode you can create a static let for global variables, which can be populated and access anywhere, I also know you can do that with a Struct, and Enum, which I believe is what your emulating with your “model” feature.

Could you point me in the right direction here, and let me know what I need to do and how to design this? How can I have global arrays…etc?

The easiest way to do this is by using Singletons. They are like static let.
You can create a new Model called for example Stored State and then add Properties to it with the Data Types that you want to store. At the end of the API call you will set the values in the Singleton and then you can use them everywhere in the app. There is no need to use the new code block on Singletons, as they are already initialised.

I assume that if I want to re-use the model, I would have to reinitialize is? For example, I have a model called “Ride” which I used for Scheduled Rides, and Ride History, but…in history I am using different information than I am in scheduled. Would I need to do this twice?

That it correct. You can reuse although the same Function property.

Can you clairfy just a bit more? So instead of the Data source i would remove that and have the API go right into the model.

And then under models, drag the “ride” model out to the screen and set whatever screen properties I need from that model?

I don’t need to do a NEW of it, unless I am changing or updating data in it?

This doesn’t seem to work for me, I am stuck. How can I do this with an array or “list” of models?

Do I go into the ride model and create a function there? This doesn’t seem to be working for me, since its not single data is several lists, and you can’t make a singleton of an array of models