Storing the data representations of multiple, differently typed objects in a single Data instance
问题 Motivation To my knowledge, Data is a struct that abstracts a byte buffer. It references a physical area in memory, in other words: a contiguous number of bytes. Now I want to efficiently store multiple values in memory (as raw data), where the values are not all of the same type . My definition of efficient here ≔ Store all those values without any unused buffer / gap bytes. Storing the raw data in memory let a: UInt8 = 39 let b: Int32 = -20001 let string: String = "How awesome is this data?