Question A: Is there an existing API call or data type that allows me to pass in a class object and returns all the byte data ?
I don’t actually know, but consider a case where an object does reference other objects. Does “all the byte data” mean you want to capture the entire object graph? That’s not necessarily what you really want.
Question B: If question A is no, could you recommend/suggest a way to achieve this?
Sounds like you just need a serialization scheme to convert an object to a byte stream. Grabbing the underlying bytes via Data(bytes:count:) is one way of course, but you could also implement a custom scheme to explicitly serialize all the object properties you need.
Then I’m guessing that however you generate a byte stream representing an object, the fun part is that you are using XOR to diff successive entries in your undo stack and storing these diffs efficiently, probably taking advantage of the diffs containing a lot of 0x00 bytes. Is that the idea? If so, then any serialization scheme that produces the desired behavior should work.
Topic:
App & System Services
SubTopic:
General
Tags: