Skip to content

Instantly share code, notes, and snippets.

@Busta117
Last active October 25, 2016 20:35
Show Gist options
  • Save Busta117/5fceb8eeb19fc6cc8b7d21baeb53b877 to your computer and use it in GitHub Desktop.
Save Busta117/5fceb8eeb19fc6cc8b7d21baeb53b877 to your computer and use it in GitHub Desktop.
merge 2 dictionaries in 1 with the operator += changes will keep in the left one
/**
add the content of a dictionary into another dictionary
swift 3
*/
func += <K>( dict1:inout [K:Any], dict2:[K:Any]){
dict2.forEach { (key: K, value: Any) in
dict1[key] = value
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment