One Logo Pool Ball
Dispatch · IOS API REFERENCE

DispatchData

struct · SDK 27.1

struct DispatchData

Members (26)

get

startIndex

TypeScript
get startIndex(): number
Swift declaration
var startIndex: DispatchData.Index { get }

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

init

init

TypeScript
static initBytesNoCopyDeallocator(bytes: Uint8Array, deallocator?: DispatchData_Deallocator): DispatchData
Swift declaration
init(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.

init

init

TypeScript
static initBytesNoCopyDeallocator16434(bytes: ArrayBuffer, deallocator?: DispatchData_Deallocator): DispatchData
Swift declaration
init(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.

method

makeIterator

TypeScript
makeIterator(): DispatchDataIterator
Swift declaration
func makeIterator() -> DispatchData.Iterator

An iterator over the contents of the data. The iterator will increment byte-by-byte.

method

enumerateBytes

TypeScript
enumerateBytes(block: ((arg0: Uint8Array, arg1: number, arg2: boolean) => void)): void
Swift declaration
func enumerateBytes(_ block: (UnsafeBufferPointer<UInt8>, Int, inout Bool) -> Void)
method

withUnsafeBytes

TypeScript
withUnsafeBytes(body: ((arg0: SDKHandle) => unknown)): unknown
Swift declaration
func withUnsafeBytes<Result, ContentType>(body: (UnsafePointer<ContentType>) throws -> Result) rethrows -> Result
init

init

TypeScript
static initBytes(buffer: Uint8Array): DispatchData
Swift declaration
init(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.

init

init

TypeScript
static initBytes9142(buffer: ArrayBuffer): DispatchData
Swift declaration
init(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

TypeScript
get count(): number
Swift declaration
var 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.

get

empty

TypeScript
static get empty(): DispatchData
Swift declaration
static let empty: DispatchData
method

index

TypeScript
indexAfter(i: number): number
Swift declaration
func index(after i: DispatchData.Index) -> DispatchData.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

index

TypeScript
indexBefore(i: number): number
Swift declaration
func index(before i: DispatchData.Index) -> DispatchData.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

append

TypeScript
appendCount(bytes: SDKHandle, count: number): void
Swift declaration
mutating 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.

method

append

TypeScript
append(other: DispatchData): void
Swift declaration
mutating func append(_ other: DispatchData)

Append data to the data. - parameter data: The data to append to this data.

method

append

TypeScript
append35900(buffer: unknown[]): void
Swift declaration
mutating 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`.

method

append

TypeScript
append90667(bytes: ArrayBuffer): void
Swift declaration
mutating 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.

method

region

TypeScript
region(location: number): { "data": DispatchData; "offset": number }
Swift declaration
func region(location: Int) -> (data: DispatchData, offset: Int)
method

subdata

TypeScript
subdata(range: SDKHandle): DispatchData
Swift declaration
func subdata(in range: Range<DispatchData.Index>) -> DispatchData

Return a new copy of the data in a specified range. - parameter range: The range to copy.

get

endIndex

TypeScript
get endIndex(): number
Swift declaration
var 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`.

method

copyBytes

TypeScript
copyBytesToFrom(buffer: unknown[], range?: (SDKHandle) | null): number
Swift declaration
func copyBytes<DestinationType>(to buffer: UnsafeMutableBufferPointer<DestinationType>, from range: Range<DispatchData.Index>? = nil) -> Int

Copy 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.

method

copyBytes

TypeScript
copyBytesToFrom39331(pointer: SDKHandle, range: SDKHandle): void
Swift declaration
func 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.

method

copyBytes

TypeScript
copyBytesToFrom82678(pointer: ArrayBuffer, range: SDKHandle): void
Swift declaration
func 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.

method

copyBytes

TypeScript
copyBytesToCount(pointer: SDKHandle, count: number): void
Swift declaration
func 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.

method

copyBytes

TypeScript
copyBytesToCount15035(pointer: ArrayBuffer, count: number): void
Swift declaration
func 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

subscript

TypeScript
subscript(bounds: SDKHandle): SDKHandle
Swift declaration
subscript(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)

subscript

subscript

TypeScript
subscript22988(index: number): number
Swift declaration
subscript(index: DispatchData.Index) -> UInt8 { get }

Sets or returns the byte at the specified index.

Skipped declarations

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(_:)'

All Dispatch types →