Q:

arrange array in [a1,b1,c1] manner

In my app i am getting 3 arrays that's named are A,B and C. Now i want to arrange all that element in single array in this manner [a1,b1,c1,a2,b2,c2] so how can i do this?
Please help me.

A:

let a = ["a1","a2","a3"]
let b = ["b1","b2","b3"]
let c = ["c1","c2","c3"]

var merged: [String] = []

(0..<max(a.count, b.count, c.count)).forEach {
    if $0 < a.count { merged.append(a[$0]) }
    if $0 < b.count { merged.append(b[$0]) }
    if $0 < c.count { merged.append(c[$0]) }
}
merged  // ["a1", "b1", "c1", "a2", "b2", "c2", "a3", "b3", "c3"]

