[swift-users] Array elements assign to variables

TUNG CK cktung at mac.com
Fri Jan 27 05:27:19 CST 2017


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]
        var brightness = pixel[3]
         .....
     }


More information about the swift-users mailing list