One Logo Pool Ball
MusicKit · IOS API REFERENCE

ApplicationMusicPlayer.Queue.Entries

struct · iOS 15.0+ · SDK 27.1

struct Entries

Members (15)

get · iOS 15.0+

startIndex

TypeScript
get startIndex(): SDKHandle
Swift declaration
var startIndex: ApplicationMusicPlayer.Queue.Entries.Index { get }

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

method · iOS 15.0+

makeIterator

TypeScript
makeIterator(): SDKHandle
Swift declaration
func makeIterator() -> ApplicationMusicPlayer.Queue.Entries.Iterator

Returns an iterator over the elements of this sequence.

method · iOS 15.0+

replaceSubrange

TypeScript
replaceSubrange(subrange: SDKHandle, newElements: Array<MusicPlayer_Queue_Entry>): void
Swift declaration
mutating func replaceSubrange<C>(_ subrange: Range<ApplicationMusicPlayer.Queue.Entries.Index>, with newElements: C) where C : Collection, C.Element == MusicPlayer.Queue.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 15.0+

index

TypeScript
indexAfter(i: SDKHandle): SDKHandle
Swift declaration
func index(after i: ApplicationMusicPlayer.Queue.Entries.Index) -> ApplicationMusicPlayer.Queue.Entries.Index

Returns the position immediately after the given index. The successor of an index must be well defined. For an index `i` into a collection `c`, calling `c.index(after: i)` returns the same index every time. - Parameter i: A valid index of the collection. `i` must be less than `endIndex`. - Returns: The index value immediately after `i`.

method · iOS 15.0+

index

TypeScript
indexBefore(i: SDKHandle): SDKHandle
Swift declaration
func index(before i: ApplicationMusicPlayer.Queue.Entries.Index) -> ApplicationMusicPlayer.Queue.Entries.Index

Returns the position immediately before the given index. - Parameter i: A valid index of the collection. `i` must be greater than `startIndex`. - Returns: The index value immediately before `i`.

method · iOS 15.0+

index

TypeScript
indexOffsetByLimitedBy(i: SDKHandle, distance: number, limit: SDKHandle): (SDKHandle) | null
Swift declaration
func index(_ i: ApplicationMusicPlayer.Queue.Entries.Index, offsetBy distance: Int, limitedBy limit: ApplicationMusicPlayer.Queue.Entries.Index) -> ApplicationMusicPlayer.Queue.Entries.Index?

Returns an index that is the specified distance from the given index, unless that distance is beyond a given limiting index. The following example obtains an index advanced four positions from a string's starting index and then prints the character at that position. The operation doesn't require going beyond the limiting `s.endIndex` value, so it succeeds. let s = "Swift" if let i = s.index(s.startIndex, offsetBy: 4, limitedBy: s.endIndex) { print(s[i]) } // Prints "t" The next example attempts to retrieve an index six positions from `s.startIndex` but fails, because that distance is beyond the index passed as `limit`. let j = s.index(s.startIndex, offsetBy: 6, limitedBy: s.endIndex) print(j) // Prints "nil" The value passed as `distance` must not offset `i` beyond the bounds of the collection, unless the index passed as `limit` prevents offsetting beyond those bounds. - Parameters: - i: A valid index of the collection. - distance: The distance to offset `i`. `distance` must not be negative unless the collection conforms to the `BidirectionalCollection` protocol. - limit: A valid index of the collection to use as a limit. If `distance > 0`, a limit that is less than `i` has no effect. Likewise, if `distance < 0`, a limit that is greater than `i` has no effect. - Returns: An index offset by `distance` from the index `i`, unless that index would be beyond `limit` in the direction of movement. In that case, the method returns `nil`. - Complexity: O(1) if the collection conforms to `RandomAccessCollection`; otherwise, O(*k*), where *k* is the absolute value of `distance`.

method · iOS 15.0+

index

TypeScript
indexOffsetBy(i: SDKHandle, distance: number): SDKHandle
Swift declaration
func index(_ i: ApplicationMusicPlayer.Queue.Entries.Index, offsetBy distance: Int) -> ApplicationMusicPlayer.Queue.Entries.Index

Returns an index that is the specified distance from the given index. The following example obtains an index advanced four positions from a string's starting index and then prints the character at that position. let s = "Swift" let i = s.index(s.startIndex, offsetBy: 4) print(s[i]) // Prints "t" The value passed as `distance` must not offset `i` beyond the bounds of the collection. - Parameters: - i: A valid index of the collection. - distance: The distance to offset `i`. `distance` must not be negative unless the collection conforms to the `BidirectionalCollection` protocol. - Returns: An index offset by `distance` from the index `i`. If `distance` is positive, this is the same value as the result of `distance` calls to `index(after:)`. If `distance` is negative, this is the same value as the result of `abs(distance)` calls to `index(before:)`. - Complexity: O(1) if the collection conforms to `RandomAccessCollection`; otherwise, O(*k*), where *k* is the absolute value of `distance`.

get · iOS 15.0+

indices

TypeScript
get indices(): SDKHandle
Swift declaration
var indices: ApplicationMusicPlayer.Queue.Entries.Indices { get }

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])

method · iOS 15.0+

distance

TypeScript
distance(start: SDKHandle, end: SDKHandle): number
Swift declaration
func distance(from start: ApplicationMusicPlayer.Queue.Entries.Index, to end: ApplicationMusicPlayer.Queue.Entries.Index) -> Int

Returns the distance between two indices. Unless the collection conforms to the `BidirectionalCollection` protocol, `start` must be less than or equal to `end`. - Parameters: - start: A valid index of the collection. - end: Another valid index of the collection. If `end` is equal to `start`, the result is zero. - Returns: The distance between `start` and `end`. The result can be negative only if the collection conforms to the `BidirectionalCollection` protocol. - Complexity: O(1) if the collection conforms to `RandomAccessCollection`; otherwise, O(*k*), where *k* is the resulting distance.

get · iOS 15.0+

endIndex

TypeScript
get endIndex(): SDKHandle
Swift declaration
var endIndex: ApplicationMusicPlayer.Queue.Entries.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`.

method · iOS 15.0+

formIndex

TypeScript
formIndexAfter(i: SDKHandle): { $ret: null; $out: { "i": SDKHandle } }
Swift declaration
func formIndex(after i: inout ApplicationMusicPlayer.Queue.Entries.Index)

Replaces the given index with its successor. - Parameter i: A valid index of the collection. `i` must be less than `endIndex`.

Omit the output parameters from the call. The result contains $ret and $out, with i inside $out.

method · iOS 15.0+

formIndex

TypeScript
formIndexBefore(i: SDKHandle): { $ret: null; $out: { "i": SDKHandle } }
Swift declaration
func formIndex(before i: inout ApplicationMusicPlayer.Queue.Entries.Index)

Replaces the given index with its predecessor. - Parameter i: A valid index of the collection. `i` must be greater than `startIndex`.

Omit the output parameters from the call. The result contains $ret and $out, with i inside $out.

init · iOS 15.0+

init

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

Creates an empty collection of entries.

subscript · iOS 15.0+

subscript

TypeScript
subscript(position: SDKHandle): MusicPlayer_Queue_Entry
Swift declaration
subscript(position: ApplicationMusicPlayer.Queue.Entries.Index) -> ApplicationMusicPlayer.Queue.Entries.Element { get set }

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 15.0+

subscript

TypeScript
subscript45748(bounds: SDKHandle): SDKHandle
Swift declaration
subscript(bounds: Range<ApplicationMusicPlayer.Queue.Entries.Index>) -> ApplicationMusicPlayer.Queue.Entries.SubSequence { get set }

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.

ApplicationMusicPlayer.Queue.Entries.init(arrayLiteral:)

A variable number of Swift arguments is not supported.

All MusicKit types →