How to merge two arrays in Swift

Zip the arrays and concatenate the results:

let A=["91","91","49"]
let B=["9989898909","9089890890","9098979896"]
let zipped = zip(A, B)
let result = zipped.map { $0.0 + " " + $0.1 }

Leave a Comment