shim.swift 294 B

1234567891011
  1. import Foundation
  2. #if !compiler(>=5)
  3. extension Data {
  4. func withUnsafeBytes<Result>(_ apply: (UnsafeRawBufferPointer) throws -> Result) rethrows -> Result {
  5. return try withUnsafeBytes {
  6. try apply(UnsafeRawBufferPointer(start: $0, count: count))
  7. }
  8. }
  9. }
  10. #endif