How to convert a multidimensional array to a single-dimensional array #programming #swift #coding