One Quickie


sizeof in swift (General->Swift)
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.



borkware home | products | miniblog | rants | quickies | cocoaheads
Advanced Mac OS X Programming book

webmonster@borkware.com