I am trying to sort an array as shown:
var arrayTst = [
[12443, "Starbucks", "Coffee1", "Coffee11", "Tea1", "Drinks1"],
[12495, "Coffee Bean", "Coffee2", "Tea2", "Cookies2"],
[13000, "GroceryMarket", "Tea3", "Bubble Tea3", "Shaved Ice3", "Mangoes"],
[10000, "Costco", "Soda4", "Salads4", "Pizza4"]
]
How can I sort this list from least to greatest using the first index(which shows the distance)? For example, since I want this array to sort from least to greatest by distance, I would want it to sort to :
var arrayTst = [
[10000, "Costco", "Soda4","Salads4","Pizza4"],
[12443, "Starbucks", "Coffee1","Coffee11", "Tea1", "Drinks1"],
[12495, "Coffee Bean", "Coffee2", "Tea2","Cookies2"],
[13000, "GroceryMarket", "Tea3", "Bubble Tea3", "Shaved Ice3", "Mangoes"]
]
The distance was calculated using .distance(from: currentLocation) and placing into the array via for loop.