Skip to content

Instance MethodFoundationEssentials

copyBytes(to:count:)

iOS 8.0+ iPadOS 8.0+ Mac Catalyst 8.0+ macOS 10.10+ tvOS 9.0+ watchOS 2.0+
Copies the provided number of bytes from the start of the type into a typed memory buffer.
@discardableResult func copyBytes<DestinationType>(to ptr: UnsafeMutableBufferPointer<DestinationType>, count: Int) -> Int

Parameters

ptr

A typed pointer to the buffer you want to copy the bytes into.

count

The number of bytes to copy.

Return Value

The number of bytes copied.