Last active
October 25, 2016 20:35
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
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