I have an array of drink toppings and want to remove the ones that aren\'t relevant to the drink, this is the code I have, but I can\'t figure out how to remove the topping
You can do in-place removal with a for loop, but it would be tricky, because you would need to iterate back to avoid disturbing indexes.
for
A simpler approach is to filter the array, and assign it back to the toppings property, like this:
toppings
toppings = toppings.filter {$0.limit != "C"}