Structureswift 6.0.1Swift
PartialRangeUpTo
A partial half-open interval up to, but not including, an upper bound.
@frozen struct PartialRangeUpTo<Bound> where Bound : Comparable
You create PartialRangeUpTo
instances by using the prefix half-open range operator (prefix ..<
).
let upToFive = ..<5.0
You can use a PartialRangeUpTo
instance to quickly check if a value is contained in a particular range of values. For example:
upToFive.contains(3.14) // true
upToFive.contains(6.28) // false
upToFive.contains(5.0) // false
You can use a PartialRangeUpTo
instance of a collection’s indices to represent the range from the start of the collection up to, but not including, the partial range’s upper bound.
let numbers = [10, 20, 30, 40, 50, 60, 70]
print(numbers[..<3])
// Prints "[10, 20, 30]"
Citizens in Swift
Type members
Instance members
Citizens in Swift
where Bound:Encodable, Bound:Comparable
Conformances
protocol Encodable
A type that can encode itself to an external representation.
Instance members
Citizens in Swift
where Bound:Comparable
Conformances
protocol Copyable
A type whose values can be implicitly or explicitly copied.
protocol Escapable
protocol RangeExpression<Bound>
A type that can be used to slice a collection.
Instance members
Type features
static func ~= (pattern: Self, value: Self.Bound
) -> Bool Returns a Boolean value indicating whether a value is included in a range.
Citizens in Swift
where Bound:Comparable, Bound:Decodable
Conformances
protocol Decodable
A type that can decode itself from an external representation.
Type members
Citizens in Swift
where Bound:Comparable, Bound:Sendable
Conformances
Extension in Testing
where Bound:Comparable
Conformances
protocol CustomTestStringConvertible
A protocol describing types with a custom string representation when presented as part of a test’s output.
Instance members
Extension in Testing
where Bound == Int
Conformances
Show system interfaces (1)
Hide system interfaces
protocol ExpectedCount
A protocol that describes a range expression that can be used with
confirmation(_:expectedCount:isolation:sourceLocation:_:)
.