根据差异创建新的字典项数组

时间:2019-06-25 19:01:07

标签: swift swift5

我需要比较名称和地址作为两个字典数组之间的匹配,并创建一个新的字典项数组,例如具有更新的电话号码-在newArray [0]中将与array [0]相同的索引持久化/ p>

array[0] = ["name": "Tom", "address": "123 street", "phone": "000-000-0000"] ["name": "Tim", "address": "321 street", "phone": "001-000-0000"]
["name": "Jo", "address": "123 street", "phone": "002-000-0000"]

array[1] = ["name": "Tom", "address": "555 street", "phone": "100-000-0000"] ["name": "Jon", "address": "12321 street", "phone": "111-111-0000"]
["name": "Tim", "address": "321 street", "phone": "002-000-0000"]

结果

newArray[0]
["name": "-", "address": "-", "phone": "-"] ["name": "Tim", "address": "321 street", "phone": "111-111-0000"] ["name": "-", "address": "-", "phone": "-"]

0 个答案:

没有答案