Inserts the given element into the set unconditionally.
SDK
- Xcode 10.2+
Framework
- Swift Standard Library
Declaration
Parameters
newMember
An element to insert into the set.
Return Value
An element equal to new
if the set already contained such a member; otherwise, nil
. In some cases, the returned element may be distinguishable from new
by identity comparison or some other means.
Discussion
If an element equal to new
is already contained in the set, new
replaces the existing element. In this example, an existing element is inserted into class
, a set of days of the week.