One Quickie


Making a Data out of an array of UInt8 (General->Swift)
var payload: [UInt8] = [0x09, 0x00, 0x07, 0x00, 0x12, 0x00, 0x64, 0x02, 0x03, 0x04,
                        0x09, 0x81, 0x12, 0x00, 0x07, 0x00, 0x32, 0x04, 0x05, 0x06,
                        0x00, 0x00, 0x00, 0x00]

let bufferPointer = UnsafeBufferPointer(start: &payload, count: payload.count)
let buffer = Data(buffer: bufferPointer)



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

webmonster@borkware.com