美文网首页
swift3.0 拼接两个字典

swift3.0 拼接两个字典

作者: 超级疯小肛 | 来源:发表于2017-08-16 09:48 被阅读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)

    相关文章

      网友评论

          本文标题:swift3.0 拼接两个字典

          本文链接:https://www.haomeiwen.com/subject/yfobrxtx.html