Instance Method


Adds to the receiving dictionary the entries from another dictionary.


func addEntries(from otherDictionary: [AnyHashable : Any])



The dictionary from which to add entries


Each value object from otherDictionary is sent a retain message before being added to the receiving dictionary. In contrast, each key object is copied (using copy(with:)—keys must conform to the NSCopying protocol), and the copy is added to the receiving dictionary.

If both dictionaries contain the same key, the receiving dictionary’s previous value object for that key is sent a release message, and the new value object takes its place.

See Also

Adding Entries to a Mutable Dictionary

func setObject(Any, forKey: NSCopying)

Adds a given key-value pair to the dictionary.

func setValue(Any?, forKey: String)

Adds a given key-value pair to the dictionary.

func setDictionary([AnyHashable : Any])

Sets the contents of the receiving dictionary to entries in a given dictionary.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software