iOS Swift Multiple dimension arrays - compiliing takes ages. What should I change?

后端 未结 1 1001
深忆病人
深忆病人 2020-11-30 15:45

I am new at swift. Never programming in ObjC before. I have got a problem with iOS application, very simple-querying arrays via the picker.

I\'ve got 4 multidimensio

相关标签:
1条回答
  • 2020-11-30 16:30

    Swift it is having a hard time trying to deduct the array type. You just have to tell Swift it is an Array of Array of Ints:

    let setting:[[Int]] = [
        [0,0,0,0,0,0,2230],
        [0,0,0,0,0,2230,2157],
        [0,0,0,0,2230,2230,2085],
        [0,0,0,0,2230,2226,2017],
        [0,0,0,2230,2230,2222,1949],
        [0,0,2230,2230,2230,2218,1880],
        [0,0,2230,2230,2230,2135,1807],
        [0,2230,2230,2230,2230,2052,1735],
        [0,2230,2230,2230,2163,1965,1655],
        [2230,2230,2230,2230,2096,1878,1576],
        [2230,2230,2230,2191,2022,1793,1497],
        [2230,2230,2230,2096,1909,1708,1415],
        [2230,2230,2171,2003,1818,1623,1337],
        [2230,2230,2112,1910,1728,1539,1259],
        [2197,2214,2021,1820,1639,1454,1195],
        [2164,2199,1930,1731,1551,1370,1131],
        [2066,2104,1842,1645,1465,1302,1067],
        [1969,2010,1755,1559,1380,1234,1003],
        [1884,1902,1650,1460,1294,1155,0],
        [1799,1794,1546,1362,1209,1077,0],
        [1726,1665,1429,1259,1110,0,0],
        [1654,1537,1312,1157,1012,0,0],
        [1579,1422,1211,1059,0,0,0],
        [1505,1308,1111,961,0,0,0]
    ]
    

    Note: By Swift convention you should name your vars starting with a lowercase letter.

    0 讨论(0)
提交回复
热议问题