Instance Method


Adds the given element to the option set if it is not already a member.


@discardableResult mutating func insert(_ newMember: ARView.DebugOptions) -> (inserted: Bool, memberAfterInsert: ARView.DebugOptions)



The element to insert.

Return Value

(true, newMember) if newMember was not contained in self. Otherwise, returns (false, oldMember), where oldMember is the member of the set equal to newMember.


In the following example, the .secondDay shipping option is added to the freeOptions option set if purchasePrice is greater than 50.0. For the ShippingOptions declaration, see the OptionSet protocol discussion.

let purchasePrice = 87.55

var freeOptions: ShippingOptions = [.standard, .priority]
if purchasePrice > 50 {
// Prints "true"

See Also

Adding and Removing Options

func remove(ARView.DebugOptions) -> ARView.DebugOptions?

Removes the given element and all elements subsumed by it.

func subtract(ARView.DebugOptions)

Removes the elements of the given set from this set.

func subtracting(ARView.DebugOptions) -> ARView.DebugOptions

Returns a new set containing the elements of this set that do not occur in the given set.