如何使用swift改变/连接两个相同类型的字典

时间:2016-03-16 06:46:12

标签: ios iphone swift ipad dictionary

let pageParams = ["page": "1",
                 "limit": "10"]

let commonParams = ["lang": "en",
                   "scale": "@3x"]

var resultParams =  ["page": "1",
                    "limit": "10",
                     "lang": "en",
                    "scale": "@3x"]

    // how to make "resultParams" by programmatically join "pageParams" with "commonParams" ? Is any short code available ?

我有两个词典具有相同的数据类型。键和值是字符串类型。我需要以编程方式加入这两个词典。 Swift有更好的短代码吗?或者我们需要循环并加入吗?

0 个答案:

没有答案