Is there a single line equivalent for this Java code used to create a 2d array:
cells = new Cell[width][height];
in Swift 2.0?
Looking at various solutions here in Stack Overflow I have ended up with a multi-line monster of:
self.cells = [[Cell]]()
for (var col=0; col<height; col++){
var newColumn = Array<Cell>.init(count: width, repeatedValue: Cell(x: 0,y: 0))
self.cells.append(newColumn);
}
which creates an empty array for me. But I am quite sure that's not the right solution, just a duct tape kind of workaround.