Sorting array, deleting and updating

I have a question regarding arrays. I am currently able to sort my array, but would like to be able to delete items from the sorted array. My app crashes after I have selected the items to delete, so I assume it has something to do with index paths? Thank you.

Hi, @jport1130 thanks for posting on here. Could you share what the console prints out once the crash occurs or share your code with the array?

@jport1130 Thanks very much for your question!

As @gdelarosa correctly pointed out, without seeing any code, it really is hard to determine what the issue is. However, one thing I would suggest is to see how your array is declared. Are you declaring it using a “let” or a “var”? If it’s a let, then that means the array is meant to be a constant, which means you are not allowed to modify (i.e. either change or update the values contained in the array). If it is declared with a “let”, then change the declaration to a “var”, and hopefully that should work. In any case, please do share the code you have so we can see how you’re doing it, and perhaps provide better alternatives :slight_smile:

I hope this helps!

All the best!

Thank you for your response. I was able to correct my problem. Thanks again!

Thank you for your response. I was able to correct my problem. Thanks again!

This topic was automatically closed after 166 days. New replies are no longer allowed.