Search code examples
arraysxcodesortinguipickerview

Uipickerview is not sorted although my array is sorted


I have an array which is already sorted, even I sort it once more by this:

let sortedListOfBanks = listOfBanks.sorted()

I am sure it works because I check it on output.

But when I run the application picker view comes with a non-alphabetical order.

code

screenshot

Many thanks in advance!


Solution

  • It was becouse I put the savecontext out of for loop