One Logo Pool Ball
SwiftUICore · IOS API REFERENCE

Text.Layout.RunSlice

struct · iOS 17.0+ · SDK 27.1

struct RunSlice

A slice of a run of placed glyphs in a text layout.

Members (11)

get · iOS 17.0+

startIndex

TypeScript
get startIndex(): number
Swift declaration
var startIndex: Int { get }

The position of the first element in a nonempty collection. If the collection is empty, `startIndex` is equal to `endIndex`.

get · iOS 17.0+

characterIndices

TypeScript
get characterIndices(): Array<Text_Layout_CharacterIndex>
Swift declaration
var characterIndices: [Text.Layout.CharacterIndex] { get }

The array of character indices corresponding to the glyphs in `self`.

get · iOS 17.0+

typographicBounds

TypeScript
get typographicBounds(): Text_Layout_TypographicBounds
Swift declaration
var typographicBounds: Text.Layout.TypographicBounds { get }

The typographic bounds of the partial run of glyphs.

init · iOS 17.0+

init

TypeScript
static init(run: Text_Layout_Run, indices: SDKHandle): Text_Layout_RunSlice
Swift declaration
init(run: Text.Layout.Run, indices: Range<Int>)
get · iOS 17.0+

run

TypeScript
get run(): Text_Layout_Run
Swift declaration
var run: Text.Layout.Run
set · iOS 17.0+

run

TypeScript
set run(value: Text_Layout_Run)
Swift declaration
var run: Text.Layout.Run
get · iOS 17.0+

indices

TypeScript
get indices(): SDKHandle
Swift declaration
var indices: Range<Int>

The indices that are valid for subscripting the collection, in ascending order. A collection's `indices` property can hold a strong reference to the collection itself, causing the collection to be nonuniquely referenced. If you mutate the collection while iterating over its indices, a strong reference can result in an unexpected copy of the collection. To avoid the unexpected copy, use the `index(after:)` method starting with `startIndex` to produce indices instead. var c = MyFancyCollection([10, 20, 30, 40, 50]) var i = c.startIndex while i != c.endIndex { c[i] /= 5 i = c.index(after: i) } // c == MyFancyCollection([2, 4, 6, 8, 10])

set · iOS 17.0+

indices

TypeScript
set indices(value: SDKHandle)
Swift declaration
var indices: Range<Int>

The indices that are valid for subscripting the collection, in ascending order. A collection's `indices` property can hold a strong reference to the collection itself, causing the collection to be nonuniquely referenced. If you mutate the collection while iterating over its indices, a strong reference can result in an unexpected copy of the collection. To avoid the unexpected copy, use the `index(after:)` method starting with `startIndex` to produce indices instead. var c = MyFancyCollection([10, 20, 30, 40, 50]) var i = c.startIndex while i != c.endIndex { c[i] /= 5 i = c.index(after: i) } // c == MyFancyCollection([2, 4, 6, 8, 10])

get · iOS 17.0+

endIndex

TypeScript
get endIndex(): number
Swift declaration
var endIndex: Int { get }

The collection's "past the end" position---that is, the position one greater than the last valid subscript argument. When you need a range that includes the last element of a collection, use the half-open range operator (`..<`) with `endIndex`. The `..<` operator creates a range that doesn't include the upper bound, so it's always safe to use with `endIndex`. For example: let numbers = [10, 20, 30, 40, 50] if let index = numbers.firstIndex(of: 30) { print(numbers[index ..< numbers.endIndex]) } // Prints "[30, 40, 50]" If the collection is empty, `endIndex` is equal to `startIndex`.

subscript · iOS 17.0+

subscript

TypeScript
subscript(index: number): Text_Layout_RunSlice
Swift declaration
subscript(index: Int) -> Text.Layout.RunSlice { get }

Accesses the element at the specified position. The following example accesses an element of an array through its subscript to print its value: var streets = ["Adams", "Bryant", "Channing", "Douglas", "Evarts"] print(streets[1]) // Prints "Bryant" You can subscript a collection with any valid index other than the collection's end index. The end index refers to the position one past the last element of a collection, so it doesn't correspond with an element. - Parameter position: The position of the element to access. `position` must be a valid index of the collection that is not equal to the `endIndex` property. - Complexity: O(1)

subscript · iOS 17.0+

subscript

TypeScript
subscript39744(bounds: SDKHandle): Text_Layout_RunSlice
Swift declaration
subscript(bounds: Range<Int>) -> Text.Layout.RunSlice { get }

Accesses a contiguous subrange of the collection's elements. For example, using a `PartialRangeFrom` range expression with an array accesses the subrange from the start of the range expression until the end of the array. let streets = ["Adams", "Bryant", "Channing", "Douglas", "Evarts"] let streetsSlice = streets[2..<5] print(streetsSlice) // ["Channing", "Douglas", "Evarts"] The accessed slice uses the same indices for the same elements as the original collection. This example searches `streetsSlice` for one of the strings in the slice, and then uses that index in the original array. let index = streetsSlice.firstIndex(of: "Evarts")! // 4 print(streets[index]) // "Evarts" Always use the slice's `startIndex` property instead of assuming that its indices start at a particular value. Attempting to access an element by using an index outside the bounds of the slice may result in a runtime error, even if that index is valid for the original collection. print(streetsSlice.startIndex) // 2 print(streetsSlice[2]) // "Channing" print(streetsSlice[0]) // error: Index out of bounds - Parameter bounds: A range of the collection's indices. The bounds of the range must be valid indices of the collection. - Complexity: O(1)

Skipped declarations

1 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

Text.Layout.RunSlice.subscript(_:)

Passing a Swift type itself is not supported.

All SwiftUICore types →