Swift 4: Keeping the same order when parsing a JSON

前端 未结 2 1428
臣服心动
臣服心动 2021-01-25 13:05

I need to show a list of addresses in my app while keeping the same order as the response JSON. It looks something like this:

{
\"addresses\": {
    \"e5fdb5ba-7         


        
2条回答
  •  逝去的感伤
    2021-01-25 13:50

    If the order of your data is important you should put it into an Array, not a Dictionary (which is inherently without order but with quick keyed access as others have noticed). Please change your backend accordingly and ask another question if it does not work.

提交回复
热议问题