2d array creation in Swift2

Hello,

is there any way to create a 2d array is Swift2 without using Zero as a starting point?

THank you for your time,

-jack

Not totally sure what you mean 'without using Zero', but the `init(count: Int, repeatedValue: Element)` initializer

from Array lets you set the size and a repeated value:


let threeTens = [[Int]](count: 3, repeatedValue: [10])
// [[10], [10], [10]]

Indexing into an array in Swift always starts at zero.


This is a guess basd on the brief context included in your question, but a custom structure or dictionary where the key is an integer index may be a more suitable model for what values you want to store.

Sorry, looks like I totally misunderstood.


Will try to read better in the future.

2d array creation in Swift2
 
 
Q