enumerateBytes(_:)
Enumerates the contents of the data’s buffer.
Declaration
func enumerateBytes(_ block: (UnsafeBufferPointer<UInt8>, Data.Index, inout Bool) -> Void)Parameters
- block:
The closure to invoke for each region of data. You may stop the enumeration by setting the
stopparameter totrue.
Discussion
In some cases, (for example, a Data backed by a dispatch_data_t, the bytes may be stored discontiguously. In those cases, this function invokes the closure for each contiguous region of bytes.