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 subset of the contents of the data to memory.
func copyBytes(to pointer: UnsafeMutablePointer<UInt8>, from range: Range<Data.Index>)

Parameters

pointer

A pointer to the buffer you wish to copy the bytes into.

range

The range in the Data to copy.

Discussion

Warning

This method does not verify that the contents at pointer have enough space to hold the required number of bytes.