Initializer

init(data:)

Returns a data object initialized with the contents of another data object.

Declaration

init(data: Data)

Parameters

data

A data object.

Return Value

A data object initialized with the contents data. The returned object might be different than the original receiver.

See Also

Creating Data

init(bytes: UnsafeRawPointer?, length: Int)

Returns a data object filled with a given number of bytes copied from a given buffer.

init(bytesNoCopy: UnsafeMutableRawPointer, length: Int)

Returns a data object filled with a given number of bytes of data from a given buffer.

init(bytesNoCopy: UnsafeMutableRawPointer, length: Int, deallocator: ((UnsafeMutableRawPointer, Int) -> Void)? = nil)

Returns a data object filled with a given number of bytes of data from a given buffer, with a custom deallocator block.

init(bytesNoCopy: UnsafeMutableRawPointer, length: Int, freeWhenDone: Bool)

Initializes a newly allocated data object by adding the given number of bytes from the given buffer.