我有2个字典数组:
serverContactsDict = [["name": “Miya”,”number": “4178547852”],
[“name": “Simon”,”number": “2458741458”],
["name": “Pio”,”number": “7414785236”]]
和
phoneContactsDict = [["name": “Miya”,”number": “4178547852”],
[“name": “Simon”,”number": “2458741458”],
["name": “Pio”,”number": “7414785236”],
["name": “Kayle”,”number": “2547859632”],
["name": “Hoya”,”number": “7485965841”]]
和
DesiredDict = [["name": “Kayle”,”number": “2547859632”],
["name": “Hoya”,”number": “7485965841”]]
尝试了很多,但没有得到想要的结果。
答案 0 :(得分:0)
let desiredDict = phoneContactsDict.filter {
let dict = $0
return !serverContactsDict.contains{ dict == $0 }
}