Hi Hbucius, You can define your own `Array2D` type that uses a 1-dimensional array as backing (for fast performance) but exposes a high-level 2-dimensional array API.
Here’s a really primitive starting point I found on GitHub: https://github.com/raywenderlich/swift-algorithm-club/blob/master/Array2D/Array2D.swift <https://github.com/raywenderlich/swift-algorithm-club/blob/master/Array2D/Array2D.swift> Cheers, Jaden Geller > On Apr 18, 2017, at 11:39 PM, Saagar Jha via swift-evolution > <swift-evolut...@swift.org> wrote: > > It might be helpful if you showed a bit more of the code you’re working on, > so that we can better see what you’re trying to do. Is there any operation in > particular that is slow? > > Also, CC’ing swift-users since I think it belongs there. > > Saagar Jha > >> On Apr 18, 2017, at 22:57, Hbucius Smith via swift-evolution >> <swift-evolut...@swift.org <mailto:swift-evolut...@swift.org>> wrote: >> >> Hello Swift community, >> >> >> When I used multidimensional array in swift, I found it is very low >> efficiency. >> >> >> I used in the following way : >> >> >> var array = Array.init(repeating: Array.init(repeating: 0, count: 5), >> count: 5) >> >> array[0][0] = 0 >> >> >> I have read some posts in stack overflow. It suggests using one dimension >> to fake multidimensional array. I think it is too ugly. DO we have better >> choice for this ? >> >> >> >> >> >> >> best wishes for you >> _______________________________________________ >> swift-evolution mailing list >> swift-evolut...@swift.org <mailto:swift-evolut...@swift.org> >> https://lists.swift.org/mailman/listinfo/swift-evolution > > _______________________________________________ > swift-evolution mailing list > swift-evolut...@swift.org > https://lists.swift.org/mailman/listinfo/swift-evolution
_______________________________________________ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users