Skip to content

Instantly share code, notes, and snippets.

@jacobsapps
Created April 30, 2025 21:34
Show Gist options
  • Save jacobsapps/6efc007e6cf0e3c6a531893d37c03641 to your computer and use it in GitHub Desktop.
Save jacobsapps/6efc007e6cf0e3c6a531893d37c03641 to your computer and use it in GitHub Desktop.
withUnsafeTemporaryAllocation(of: UInt8.self, capacity: size) { tempBuffer in
for i in 0..<tempBuffer.count {
tempBuffer[i] = UInt8(i * 2)
}
for byte in tempBuffer {
print(byte) // 0, 2, 4, 6, 8, 10, 12, 14
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment