Skip to content

Instance MethodFoundationEssentials

copyBytes(to:from:)

iOS 8.0+ iPadOS 8.0+ Mac Catalyst 8.0+ macOS 10.10+ tvOS 9.0+ watchOS 2.0+
Copies a range of the bytes from the type into a typed memory buffer.
@discardableResult func copyBytes<DestinationType, R>(to ptr: UnsafeMutableBufferPointer<DestinationType>, from range: R) -> Int where R : RangeExpression, Self.Index == R.Bound

Parameters

ptr

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

range

The range of bytes to copy.

Return Value

The number of bytes copied.