One Logo Pool Ball
FoundationModels · IOS API REFERENCE

Transcript.HistoryView

struct · iOS 27.0+ · SDK 27.1

struct HistoryView

A mutable view into the conversational entries of a ``Transcript``.

Members (7)

get · iOS 27.0+

startIndex

TypeScript
get startIndex(): Transcript_HistoryView_Index
Swift declaration
var startIndex: Transcript.HistoryView.Index { get }

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

method · iOS 27.0+

replaceSubrange

TypeScript
replaceSubrange(subrange: SDKHandle, newElements: Array<Transcript_Entry>): void
Swift declaration
mutating func replaceSubrange<C>(_ subrange: Range<Transcript.HistoryView.Index>, with newElements: C) where C : Collection, C.Element == Transcript.Entry

Replaces the specified subrange of elements with the given collection. This method has the effect of removing the specified range of elements from the collection and inserting the new elements at the same location. The number of new elements need not match the number of elements being removed. In this example, three elements in the middle of an array of integers are replaced by the five elements of a `Repeated<Int>` instance. var nums = [10, 20, 30, 40, 50] nums.replaceSubrange(1...3, with: repeatElement(1, count: 5)) print(nums) // Prints "[10, 1, 1, 1, 1, 1, 50]" If you pass a zero-length range as the `subrange` parameter, this method inserts the elements of `newElements` at `subrange.startIndex`. Calling the `insert(contentsOf:at:)` method instead is preferred. Likewise, if you pass a zero-length collection as the `newElements` parameter, this method removes the elements in the given subrange without replacement. Calling the `removeSubrange(_:)` method instead is preferred. Calling this method may invalidate any existing indices for use with this collection. - Parameters: - subrange: The subrange of the collection to replace. The bounds of the range must be valid indices of the collection. - newElements: The new elements to add to the collection. - Complexity: O(*n* + *m*), where *n* is length of this collection and *m* is the length of `newElements`. If the call to this method simply appends the contents of `newElements` to the collection, this method is equivalent to `append(contentsOf:)`.

method · iOS 27.0+

append

TypeScript
append(newElement: Transcript_Entry): void
Swift declaration
mutating func append(_ newElement: Transcript.Entry)

Adds an element to the end of the collection. If the collection does not have sufficient capacity for another element, additional storage is allocated before appending `newElement`. The following example adds a new number to an array of integers: var numbers = [1, 2, 3, 4, 5] numbers.append(100) print(numbers) // Prints "[1, 2, 3, 4, 5, 100]" - Parameter newElement: The element to append to the collection. - Complexity: O(1) on average, over many calls to `append(_:)` on the same collection.

get · iOS 27.0+

endIndex

TypeScript
get endIndex(): Transcript_HistoryView_Index
Swift declaration
var endIndex: Transcript.HistoryView.Index { 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`.

init · iOS 27.0+

init

TypeScript
static init(): Transcript_HistoryView
Swift declaration
init()

Creates a new, empty collection.

subscript · iOS 27.0+

subscript

TypeScript
subscript(position: Transcript_HistoryView_Index): Transcript_Entry
Swift declaration
subscript(position: Transcript.HistoryView.Index) -> Transcript.Entry { get set }

Accesses the element at the specified position. For example, you can replace an element of an array by using its subscript. var streets = ["Adams", "Bryant", "Channing", "Douglas", "Evarts"] streets[1] = "Butler" print(streets[1]) // Prints "Butler" 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 27.0+

subscript

TypeScript
subscript34821(bounds: SDKHandle): Transcript_HistoryView
Swift declaration
subscript(bounds: Range<Transcript.HistoryView.Index>) -> Transcript.HistoryView { get set }

Accesses a contiguous subrange of the collection's elements. The accessed slice uses the same indices for the same elements as the original collection. Always use the slice's `startIndex` property instead of assuming that its indices start at a particular value. This example demonstrates getting a slice of an array of strings, finding the index of one of the strings in the slice, and then using that index in the original array. var streets = ["Adams", "Bryant", "Channing", "Douglas", "Evarts"] let streetsSlice = streets[2 ..< streets.endIndex] print(streetsSlice) // Prints "["Channing", "Douglas", "Evarts"]" let index = streetsSlice.firstIndex(of: "Evarts") // 4 streets[index!] = "Eustace" print(streets[index!]) // Prints "Eustace" - 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

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

Transcript.HistoryView.append(contentsOf:)

This parameter hides a concrete Swift type.

Transcript.HistoryView.init(arrayLiteral:)

A variable number of Swift arguments is not supported.

All FoundationModels types →