formUnion(_:)
Adds the contents of the given range set to this range set.
- iOS
- 18.0+
- macOS
- 15.0+
- tvOS
- 18.0+
- visionOS
- 2.0+
- watchOS
- 11.0+
mutating func formUnion(_ other: RangeSet<Bound>) Parameters
- other
A range set to merge with this one.
Adds the contents of the given range set to this range set.
mutating func formUnion(_ other: RangeSet<Bound>) where Bound:ComparableA range set to merge with this one.
import Swiftstruct RangeSet<Bound> where Bound : ComparableA set of values of any comparable type, represented by ranges.
protocol Comparable : EquatableA type that can be compared using the relational operators <, <=, >=, and >.
init<S, C>(_ indices: S, within collection: C) where Bound == S.Element, S : Sequence, C : Collection, S.Element == C.Index Creates a new range set containing ranges that contain only the specified indices in the given collection.
var description: String { get }static func == (left: RangeSet<Bound>, right: RangeSet<Bound>) -> Bool mutating func formIntersection(_ other: RangeSet<Bound>) Removes the contents of this range set that aren’t also in the given range set.
mutating func formSymmetricDifference(_ other: RangeSet<Bound>) Removes the contents of this range set that are also in the given set and adds the contents of the given set that are not already in this range set.
@discardableResult mutating func insert<C>(_ index: Bound, within collection: C) -> Bool where Bound == C.Index, C : Collection Inserts a range that contains only the specified index into the range set.
func intersection(_ other: RangeSet<Bound>) -> RangeSet<Bound> Returns a new range set containing the contents of both this set and the given set.
func isDisjoint(_ other: RangeSet<Bound>) -> Bool Returns a Boolean value that indicates whether this range set set has no members in common with the given set.
func isStrictSubset(of other: RangeSet<Bound>) -> Bool Returns a Boolean value that indicates whether this range set is a strict subset of the given set.
func isStrictSuperset(of other: RangeSet<Bound>) -> Bool Returns a Boolean value that indicates whether this range set is a strict superset of the given set.
func isSubset(of other: RangeSet<Bound>) -> Bool Returns a Boolean value that indicates whether this range set is a subset of the given set.
func isSuperset(of other: RangeSet<Bound>) -> Bool Returns a Boolean value that indicates whether this range set is a superset of the given set.
mutating func remove<C>(_ index: Bound, within collection: C) where Bound == C.Index, C : Collection Removes the range that contains only the specified index from the range set.
mutating func subtract(_ other: RangeSet<Bound>) Removes the contents of the given range set from this range set.
func subtracting(_ other: RangeSet<Bound>) -> RangeSet<Bound> Returns a new set containing the contents of this range set that are not also in the given range set.
func symmetricDifference(_ other: RangeSet<Bound>) -> RangeSet<Bound> Returns a new range set representing the values in this range set or the given range set, but not both.
func union(_ other: RangeSet<Bound>) -> RangeSet<Bound> Returns a new range set containing the contents of both this set and the given set.
struct RangesA collection of the ranges that make up a range set.