<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/RangeSet/init(_:)-9x0yj",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s8RangeSetVyAByxGqd__cSTRd__SnyxG7ElementRtd__lufc"
  },
  "title" : "init(_:)"
}
-->

# init(_:)

Creates a range set containing the values in the given ranges.

```
init(_ ranges: some Sequence<Range<Bound>>)
```

## Parameters

`ranges`

The ranges to use for the new range set.

## Discussion

Any empty ranges in `ranges` are ignored, and non-empty ranges are merged
to eliminate any overlaps. As such, the `ranges` collection in the
resulting range set may not be equivalent to the sequence of ranges
passed to this initializer.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)