Merge pull request #388 from ktopley-apple/ktopley-dispatch-42-rdar40951342
Add documentation comments.
diff --git a/src/swift/Data.swift b/src/swift/Data.swift
index cc85a08..e78b833 100644
--- a/src/swift/Data.swift
+++ b/src/swift/Data.swift
@@ -117,9 +117,23 @@
return try body(contentPtr)
}
+ @available(swift 4.2)
+ public func enumerateBytes(
+ _ block: (_ buffer: UnsafeBufferPointer<UInt8>, _ byteIndex: Int, _ stop: inout Bool) -> Void)
+ {
+ enumerateBytesCommon(block)
+ }
+
+ @available(swift, obsoleted: 4.2, renamed: "enumerateBytes(_:)")
public func enumerateBytes(
block: (_ buffer: UnsafeBufferPointer<UInt8>, _ byteIndex: Int, _ stop: inout Bool) -> Void)
{
+ enumerateBytesCommon(block)
+ }
+
+ private func enumerateBytesCommon(
+ _ block: (_ buffer: UnsafeBufferPointer<UInt8>, _ byteIndex: Int, _ stop: inout Bool) -> Void)
+ {
// we know that capturing block in the closure being created/passed to dispatch_data_apply
// does not cause block to escape because dispatch_data_apply does not allow its
// block argument to escape. Therefore, the usage of withoutActuallyEscaping to