-2

I am get data from Server which i convert into Dictionary using #SwiftyJson. When i iterate this dictionary item not showing same order all time.Different its show different Order.How can I get the same order which one give me from server? Here is my response data..

{

content = "what type you like?";
"demoID" = 6;
suggestion =     {
    "example 1" = "Blonde";
    "example 2" = "Dark";
    "example 3" = "Dirty";

};

}

This code use with #SwiftJson

if let responseDict = responseData.dictionary, let suggestion = responseDict["suggestion"]?.dictionary {

}

Morshed Alam
  • 153
  • 2
  • 10

1 Answers1

-1

Dictionaries in swift are always unsorted by design! If you want to have it sorted, you need to use another data structure like an array.

Florensvb
  • 209
  • 1
  • 10