On Dec 21, 2017, at 18:04 , Daryle Walker <dary...@mac.com> wrote:
> 
> when multiple blocks are used

At this point, I don’t understand what you don’t understand. Here’s a code 
fragment that works in a playground:

> import Foundation
> 
> let buffer1: [UInt8] = [1,2]
> let buffer2: [UInt8] = [3,4,5,6]
> 
> var data = DispatchData.empty
> data.append (buffer1.withUnsafeBytes { DispatchData (bytesNoCopy: $0) })
> data.append (buffer2.withUnsafeBytes { DispatchData (bytesNoCopy: $0) })
> 
> print (data.count)
> data.enumerateBytes {
>       bytes, index, stop in
>       print (bytes.count, index, bytes [0])
> }

producing this output:

> 6
> 2 0 1
> 4 2 3

Isn’t this what you were asking for: a loop enumerating each of the contiguous 
portions of a larger data set?

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to