Instance Method


Removes the given element and any elements subsumed by the given element.

Required. Default implementation provided.


@discardableResult mutating func remove(_ member: Self.Element) -> Self.Element?



The element of the set to remove.

Return Value

For ordinary sets, an element equal to member if member is contained in the set; otherwise, nil. In some cases, a returned element may be distinguishable from newMember by identity comparison or some other means.

For sets where the set type and element type are the same, like OptionSet types, this method returns any intersection between the set and [member], or nil if the intersection is empty.

Default Implementations

OptionSet Implementations

func remove(Self.Element) -> Self.Element?

Removes the given element and all elements subsumed by it.

See Also

Adding and Removing Elements

func insert(Self.Element) -> (inserted: Bool, memberAfterInsert: Self.Element)

Inserts the given element in the set if it is not already present.

Required. Default implementation provided.

func update(with: Self.Element) -> Self.Element?

Inserts the given element into the set unconditionally.

Required. Default implementation provided.