I have some objects in parse server, I am retrieving the objects successfully. The issue I am having is that I have a PFFile object storing images and it’s Optional. Whenever the PFFile array doesn’t have the same number of values as the other arrays populating my tableview, the program crashes because the index is out of range. I am unable able to increment the PFFile array index with the indexes of the other arrays to populate my TableView. How can I increment the index of the PFFIle array to have the same index count as the other arrays? Any help in the right direction would be appreciated.
Asked
Active
Viewed 84 times
0
-
3You are strongly discouraged from using multiple arrays as data source. This is an object oriented language. Use a custom struct or class. – vadian Apr 05 '18 at 16:14
-
@vadian, thanks for your reply. I am getting the data from parse, so that's the only way I know of to retrieve data from parse. My issue is trying to figure out how to increment the an array with PFFile objects – Iam Wayne Apr 05 '18 at 16:25
-
@IamWayne If you get your data from your source as separate arrays, I'd iterate through them at data collection time and merge them into a single array of a custom struct as soon as you get them. Dealing with multiple parallel arrays like this is just going to lead to a lot of headaches. – Charles Srstka Apr 06 '18 at 01:04
-
Without code, I've got no idea what your data looks like, but here's an option you might be able to consider. https://stackoverflow.com/a/40540683/4475605 – Adrian Apr 06 '18 at 02:01