I need to enumerate a zipped array to check index for each object from array. Below is my code please help me out.
for((index1, index2),(value1, value2)) in zip(array1, array2).enumerated() {
// INDEX OF OBJECT
}
Once you zip the array it is having only one index. Just use it as normal enumerations.
let arr1 = ["1","2","3"]
let arr2 = ["A","B"]
let arr3 = zip(arr1, arr2)
print(arr3)
for (index, (x,y)) in arr3.enumerated() {
print(index, y)
}
enjoy!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With