migueldeicaza / SwiftGodot

New Godot bindings for Swift
https://migueldeicaza.github.io/SwiftGodotDocs/tutorials/swiftgodot-tutorials/
MIT License
1.14k stars 76 forks source link

PackedByteArray to Data helper function #374

Closed migueldeicaza closed 6 months ago

migueldeicaza commented 9 months ago

Currently, I do not expose a "pointer to the array" feature, I could either expose that, or even better, expose a function that returns the Data() for it.

tishin commented 7 months ago

@migueldeicaza I believe this was done in https://github.com/migueldeicaza/SwiftGodot/commit/39c67bf8f4f266802010fc2092d513d7918876c4 But maybe it would make more sense to expose a helper function that returns a byte array instead, without introducing SwiftGodot's dependency on Foundation?

migueldeicaza commented 7 months ago

Yes, let us do that for now

migueldeicaza commented 7 months ago

Even better, we could surface a withUnsafeAccess helper method that gives us the pointer and addrsss, so folks can do their own data wrapper easily without copying the daya

migueldeicaza commented 6 months ago

Closing, implemented alternative without Foundation dependency.