Options.remove(_:)
Removes the given element and all elements subsumed by it.
Source and package
- Qualified name
-
RegexPattern .Options. remove(_:) - Module
- RegexPattern
- Declared in
Options- Package
- libtmux-swift
-
Inherited from
OptionSet.remove(_:)Description#
In the following example, the
.priorityshipping option is removed from theoptionsoption set. Attempting to remove the same shipping option a second time results innil, becauseoptionsno longer contains.priorityas a member.var options: ShippingOptions = [.secondDay, .priority] let priorityOption = options.remove(.priority) print(priorityOption == .priority) // Prints "true"
print(options.remove(.priority)) // Prints "nil"
In the next example, the
.expresselement is passed toremove(_:). Although.expressis not a member ofoptions,.expresssubsumes the remaining.secondDayelement of the option set. Therefore,optionsis emptied and the intersection between.expressandoptionsis returned.let expressOption = options.remove(.express) print(expressOption == .express) // Prints "false" print(expressOption == .secondDay) // Prints "true"
- Parameter member: The element of the set to remove.
- Returns: The intersection of
[member]and the set, if the intersection was nonempty; otherwise,nil.