Options.insert(_:)
Adds the given element to the option set if it is not already a member.
Source and package
- Qualified name
-
RegexPattern .Options. insert(_:) - Module
- RegexPattern
- Declared in
Options- Package
- libtmux-swift
-
Inherited from
OptionSet.insert(_:)Description#
In the following example, the
.secondDayshipping option is added to thefreeOptionsoption set ifpurchasePriceis greater than 50.0. For theShippingOptionsdeclaration, see theOptionSetprotocol discussion.let purchasePrice = 87.55
var freeOptions: ShippingOptions = [.standard, .priority] if purchasePrice > 50 { freeOptions.insert(.secondDay) } print(freeOptions.contains(.secondDay)) // Prints "true"
- Parameter newMember: The element to insert.
- Returns:
(true, newMember)ifnewMemberwas not contained inself. Otherwise, returns(false, oldMember), whereoldMemberis the member of the set equal tonewMember.