Issue with creating local array of models - Causing APP to crash

I am having an issue here that is causing my app (not Kodika) to crash. I would like to populate a list view that has a cell with an icon and label. I have done this in several other list views using API calls, Datasources…etc and it all worked. What I am trying to do now is create my own “array of models” so that I can populate the tableview with my data. I want to make a menu screen, I don’t need this data from any API call, I want to create it locally on the app.

So what I am doing is creating a new function property with an array (list) of the account models. I am then creating a function property of the models themselves and populating with data. This one is called payment. I am then appending that model in the new account screen models function property.

When I set this function to run every time the screen loads my app crashes, I assume I am not doing something right and this is empty?

However, when I create a list of texts and then do the same thing (in list, append object), it populates the cells and doesn’t crash. That is useless because I need the icons as well.

Can you tell me what I am doing wrong and how I can populate my own list of “models” locally on the app?


image
image

Hi,
You will need to create a new instance of Payment each time.
You need to use the new block for this

In each Model, you will find a brown new block. You need to set your Payment Object to new first and then start populating it with the red blocks.

**Note:**Each time that you want a new instance, you need to use the new block again. You can reuse the same Function Property.

This worked, thank you!

1 Like