Say you have a struct: struct Thingie { let blah: Uint8 let greeble: UInt8 let splunge: UInt8 } Get the sizeof via let packetLength = MemoryLayout.size That's the packed size. To account for alignment/padding, use stride.
struct Thingie { let blah: Uint8 let greeble: UInt8 let splunge: UInt8 }
let packetLength = MemoryLayout.size