On Dec 22, 2017, at 08:48 , Daryle Walker <dary...@mac.com> wrote: > > DispatchData would need to be convertible to Data. Is there a way to do the > conversion in Swift?
Actually, on consideration, I think not. It would be if DispatchData was bridgeable like Data, but it isn’t, and I don’t see any way of extracting its underlying reference. This leaves you with two options that I can see: 1. Use an Obj-C helper function, taking an array of input buffers, and returning a dispatch_data_t object that combines them, cast to a NSData*. You can then use the returned reference as Data. 2. Move your Data extension to DispatchData. That’s what I was asking about earlier — is there any reason why you couldn’t just use DispatchData rather than Data, in all the code that deals with this data set? In that case, you can just build the DispatchData in Swift. IAC, you should probably submit a bug report. Since dispatch_data_t is documented to be a subclass of NSData, there should probably be a mechanism for getting Data and DispatchData values as equivalents of each other, without any unprovoked copying of the underlying data. _______________________________________________ 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