Contents

setObject(_:forKey:)

Adds a given key-value pair to the dictionary.

Declaration

func setObject(_ anObject: Any, forKey aKey: any NSCopying)

Parameters

  • anObject:

    The value for aKey. A strong reference to the object is maintained by the dictionary.

  • aKey:

    The key for value. The key is copied (using Copy(with:); keys must conform to the NSCopying protocol). If aKey already exists in the dictionary, anObject takes its place.

See Also

Related Documentation

Adding Entries to a Mutable Dictionary