On this page
RegexPattern.Options.insert(_:)
- Module
- RegexPattern
- Declared in
- Options
- Package
- libtmux-swift
- insert(_:) ( newMember : Self.Element ) (inserted: Bool, memberAfterInsert: Self.Element)
-
Adds the given element to the option set if it is not already a member.
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.
0 declared, 0 inherited