Return Value 戻り値
For ordinary sets, 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.
Availability 有効性
Technology
mutating func update(with newMember: AccessibilityTechnologies
) -> AccessibilityTechnologies
?
For ordinary sets, 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.
newMember
An element to insert into the set.
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.
enum DayOfTheWeek: Int {
case sunday, monday, tuesday, wednesday, thursday,
friday, saturday
}
var classDays: Set<DayOfTheWeek> = [.monday, .wednesday, .friday]
print(classDays.update(with: .monday))
// Prints "Optional(.monday)"