Initializerswift 6.0.3Swift

init(_:)

Creates an instance equivalent to the given ClosedRange.

init(_ other: ClosedRange<Bound>)

Parameters

other

A closed range to convert to a Range instance.

An equivalent range must be representable as an instance of Range. For example, passing a closed range with an upper bound of Int.max triggers a runtime error, because the resulting half-open range would require an upper bound of Int.max + 1, which is not representable as an Int.