0001 // 0002 // Dictionary+Merge.swift 0003 // SourceKitten 0004 // 0005 // Created by JP Simard on 2015-01-08. 0006 // Copyright (c) 2015 SourceKitten. All rights reserved. 0007 // 0008 0009 /** 0010 Returns a new dictionary by adding the entries of dict2 into dict1, overriding if the key exists. 0011 0012 - parameter dict1: Dictionary to merge into. 0013 - parameter dict2: Dictionary to merge from (optional). 0014 0015 - returns: A new dictionary by adding the entries of dict2 into dict1, overriding if the key exists. 0016 */ 0017 internal func merge<K,V>(dict1: [K: V], _ dict2: [K: V]?) -> [K: V] { 0018 var mergedDict = dict1 0019 if let dict2 = dict2 { 0020 for (key, value) in dict2 { 0021 mergedDict[key] = value 0022 } 0023 } 0024 return mergedDict 0025 } 0026
File.swift:126 dictionary = merge(File.swift:145 dictionary = merge(dictionary, parsedXMLDocs)