Instance Method

update(with:)

Inserts the given element into the set.

Declaration

@discardableResult mutating func update(with newMember: DispatchIO.CloseFlags) -> DispatchIO.CloseFlags?

Return Value

The intersection of [newMember] and the set if the intersection was nonempty; otherwise, nil.

Discussion

If newMember is not contained in the set but subsumes current members of the set, the subsumed members are returned.

var options: ShippingOptions = [.secondDay, .priority]
let replaced = options.update(with: .express)
print(replaced == .secondDay)
// Prints "true"

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