How about:
typealias PixelTuple = (red: UInt8, green: UInt8, blue: UInt8, brightness:
UInt8)
let pixelCount = 10
let pointer = UnsafeMutableRawPointer.allocate(bytes: 4*pixelCount, alignedTo:
16)
defer {
pointer.deallocate(bytes: 4*pixelCount, alignedTo: 16)
}
let tuplesPointer = pointer.bi
Thanks
I think we could only do this in swift
var (r,g,b,brightness) = (pixel[0],pixel[1],pixel[2],pixel[3])
> Alex Blewitt
>
>> On 27 Jan 2017, at 11:27 via swift-users wrote:
>>
>> Python, we have this
>>for pixel in pixels:
>>r, g, b, brightness = pixel
>>.
>>
>>
On 27 Jan 2017, at 11:27, TUNG CK via swift-users wrote:
>
> Python, we have this
>for pixel in pixels:
>r, g, b, brightness = pixel
>.
>
> I wonder how to do it in swift? is there a more swifty way to do something
> like this below?
>for pixel in pixels {
>v
Python, we have this
for pixel in pixels:
r, g, b, brightness = pixel
.
I wonder how to do it in swift? is there a more swifty way to do something like
this below?
for pixel in pixels {
var r = pixel[0]
var g = pixel[1]
var b = pixel[2]