startIndex
TypeScriptget startIndex(): numberSwift declarationvar startIndex: DispatchData.Index { get }The position of the first element in a nonempty collection. If the collection is empty, `startIndex` is equal to `endIndex`.
struct · SDK 27.1
struct DispatchDataget startIndex(): numberSwift declarationvar startIndex: DispatchData.Index { get }The position of the first element in a nonempty collection. If the collection is empty, `startIndex` is equal to `endIndex`.
static initBytesNoCopyDeallocator(bytes: Uint8Array, deallocator?: DispatchData_Deallocator): DispatchDataSwift declarationinit(bytesNoCopy bytes: UnsafeBufferPointer<UInt8>, deallocator: DispatchData.Deallocator = .free)Initialize a `Data` without copying the bytes. - parameter bytes: A pointer to the bytes. - parameter count: The size of the bytes. - parameter deallocator: Specifies the mechanism to free the indicated buffer.
static initBytesNoCopyDeallocator16434(bytes: ArrayBuffer, deallocator?: DispatchData_Deallocator): DispatchDataSwift declarationinit(bytesNoCopy bytes: UnsafeRawBufferPointer, deallocator: DispatchData.Deallocator = .free)Initialize a `Data` without copying the bytes. - parameter bytes: A pointer to the bytes. - parameter count: The size of the bytes. - parameter deallocator: Specifies the mechanism to free the indicated buffer.
makeIterator(): DispatchDataIteratorSwift declarationfunc makeIterator() -> DispatchData.IteratorAn iterator over the contents of the data. The iterator will increment byte-by-byte.
enumerateBytes(block: ((arg0: Uint8Array, arg1: number, arg2: boolean) => void)): voidSwift declarationfunc enumerateBytes(_ block: (UnsafeBufferPointer<UInt8>, Int, inout Bool) -> Void)withUnsafeBytes(body: ((arg0: SDKHandle) => unknown)): unknownSwift declarationfunc withUnsafeBytes<Result, ContentType>(body: (UnsafePointer<ContentType>) throws -> Result) rethrows -> Resultstatic initBytes(buffer: Uint8Array): DispatchDataSwift declarationinit(bytes buffer: UnsafeBufferPointer<UInt8>)Initialize a `Data` with copied memory content. - parameter bytes: A pointer to the memory. It will be copied. - parameter count: The number of bytes to copy.
static initBytes9142(buffer: ArrayBuffer): DispatchDataSwift declarationinit(bytes buffer: UnsafeRawBufferPointer)Initialize a `Data` with copied memory content. - parameter bytes: A pointer to the memory. It will be copied. - parameter count: The number of bytes to copy.
get count(): numberSwift declarationvar count: Int { get }The number of elements in the collection. To check whether a collection is empty, use its `isEmpty` property instead of comparing `count` to zero. Unless the collection guarantees random-access performance, calculating `count` can be an O(*n*) operation. - Complexity: O(1) if the collection conforms to `RandomAccessCollection`; otherwise, O(*n*), where *n* is the length of the collection.
static get empty(): DispatchDataSwift declarationstatic let empty: DispatchDataindexAfter(i: number): numberSwift declarationfunc index(after i: DispatchData.Index) -> DispatchData.IndexReturns 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`.
indexBefore(i: number): numberSwift declarationfunc index(before i: DispatchData.Index) -> DispatchData.IndexReturns 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`.
appendCount(bytes: SDKHandle, count: number): voidSwift declarationmutating func append(_ bytes: UnsafePointer<UInt8>, count: Int)Append bytes to the data. - parameter bytes: A pointer to the bytes to copy in to the data. - parameter count: The number of bytes to copy.
append(other: DispatchData): voidSwift declarationmutating func append(_ other: DispatchData)Append data to the data. - parameter data: The data to append to this data.
append35900(buffer: unknown[]): voidSwift declarationmutating func append<SourceType>(_ buffer: UnsafeBufferPointer<SourceType>)Append a buffer of bytes to the data. - parameter buffer: The buffer of bytes to append. The size is calculated from `SourceType` and `buffer.count`.
append90667(bytes: ArrayBuffer): voidSwift declarationmutating func append(_ bytes: UnsafeRawBufferPointer)Append bytes to the data. - parameter bytes: A pointer to the bytes to copy in to the data. - parameter count: The number of bytes to copy.
region(location: number): { "data": DispatchData; "offset": number }Swift declarationfunc region(location: Int) -> (data: DispatchData, offset: Int)subdata(range: SDKHandle): DispatchDataSwift declarationfunc subdata(in range: Range<DispatchData.Index>) -> DispatchDataReturn a new copy of the data in a specified range. - parameter range: The range to copy.
get endIndex(): numberSwift declarationvar endIndex: DispatchData.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`.
copyBytesToFrom(buffer: unknown[], range?: (SDKHandle) | null): numberSwift declarationfunc copyBytes<DestinationType>(to buffer: UnsafeMutableBufferPointer<DestinationType>, from range: Range<DispatchData.Index>? = nil) -> IntCopy the contents of the data into a buffer. This function copies the bytes in `range` from the data into the buffer. If the count of the `range` is greater than `MemoryLayout<DestinationType>.stride * buffer.count` then the first N bytes will be copied into the buffer. - precondition: The range must be within the bounds of the data. Otherwise `fatalError` is called. - parameter buffer: A buffer to copy the data into. - parameter range: A range in the data to copy into the buffer. If the range is empty, this function will return 0 without copying anything. If the range is nil, as much data as will fit into `buffer` is copied. - returns: Number of bytes copied into the destination buffer.
copyBytesToFrom39331(pointer: SDKHandle, range: SDKHandle): voidSwift declarationfunc copyBytes(to pointer: UnsafeMutablePointer<UInt8>, from range: Range<DispatchData.Index>)Copy a subset of the contents of the data to a pointer. - parameter pointer: A pointer to the buffer you wish to copy the bytes into. - parameter range: The range in the `Data` to copy. - warning: This method does not verify that the contents at pointer have enough space to hold the required number of bytes.
copyBytesToFrom82678(pointer: ArrayBuffer, range: SDKHandle): voidSwift declarationfunc copyBytes(to pointer: UnsafeMutableRawBufferPointer, from range: Range<DispatchData.Index>)Copy a subset of the contents of the data to a pointer. - parameter pointer: A pointer to the buffer you wish to copy the bytes into. The buffer must be large enough to hold `count` bytes. - parameter range: The range in the `Data` to copy.
copyBytesToCount(pointer: SDKHandle, count: number): voidSwift declarationfunc copyBytes(to pointer: UnsafeMutablePointer<UInt8>, count: Int)Copy the contents of the data to a pointer. - parameter pointer: A pointer to the buffer you wish to copy the bytes into. - parameter count: The number of bytes to copy. - warning: This method does not verify that the contents at pointer have enough space to hold `count` bytes.
copyBytesToCount15035(pointer: ArrayBuffer, count: number): voidSwift declarationfunc copyBytes(to pointer: UnsafeMutableRawBufferPointer, count: Int)Copy the contents of the data to a pointer. - parameter pointer: A pointer to the buffer you wish to copy the bytes into. The buffer must be large enough to hold `count` bytes. - parameter count: The number of bytes to copy.
subscript(bounds: SDKHandle): SDKHandleSwift declarationsubscript(bounds: Range<Int>) -> Slice<DispatchData> { get }Accesses a contiguous subrange of the collection's elements. The accessed slice uses the same indices for the same elements as the original collection uses. 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. let 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 print(streets[index!]) // Prints "Evarts" - Parameter bounds: A range of the collection's indices. The bounds of the range must be valid indices of the collection. - Complexity: O(1)
subscript22988(index: number): numberSwift declarationsubscript(index: DispatchData.Index) -> UInt8 { get }Sets or returns the byte at the specified index.
1 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.
DispatchData.enumerateBytes(block:)
The iOS SDK compiler rejected this binding: 'enumerateBytes(block:)' has been renamed to 'enumerateBytes(_:)'