swift3.0 拼接两个字典
2017-08-16 本文已影响0人
超级疯小肛
func appendAnotherDic( left: inout Dictionary, right: Dictionary) {
for (k, v) in right {
left.updateValue(v, forKey: k)
}
}
var dic1 = ["first": "1", "second": "2"]
let dic2 = ["third": "3", "forth": "4"]
appendAnotherDic(left: &dic1, right: dic2)
print(dic1)