2
votes

I'm trying write my iOS app with static data where the data will be saved in Array. But if I'm working with 4-5 items, is it OK, if is there more than 5, the compiler doesn't work. He is on the step like you can see on this screen:

enter image description here

And I need the informations next the name of items. Someone know where is problem, how I can fix it?

var people = [

[1, "Breta", 3],
[2, "Brunda", 3],
[3, "Antonin", 3],
[4, "Andolf", 3],
[5, "Barborka", 2],
[6, "Boruvka", 2],
[7, "Anicka", 2],
[8, "Antonin", 3],
[9, "Andolf", 3],
[10, "Barborka", 2],
[11, "Boruvka", 2],
[12, "Anicka", 2],
[13, "Antonin", 3],
[14, "Andolf", 3],
[15, "Barborka", 2],
[16, "Boruvka", 2],
[17, "Anicka", 2],
[18, "Antonin", 3],
[19, "Andolf", 3],
[20, "Barborka", 2],
[21, "Boruvka", 2],
[22, "Anicka", 2],
[23, "Antonin", 3],
[24, "Andolf", 3],
[25, "Barborka", 2],
[26, "Boruvka", 2],
[27, "Anicka", 2],
[28, "Andulka", 2]

]
2
your question is highly ambiguous, can you elaborate what you do really want to get fixed? - holex
This is my data collection. I'm working with this data like searching, filtering etc. in the array "people". But the compiler still doesn't work if I commented all the code for searching, filtering... etc. I think, the Xcode can't save this format of array if has more than some few items (arrays inside)? Or I don't know. - Vlastimil Fiser
Actually question is pretty accurate, XCode can't compile with more then 5 items in people array... Reproduced it. - Miknash
The array is not connected to another code (if I'm all commented) and if has 5 items, all works perfectly. If has more than 5, compiler can't finish the building process. - Vlastimil Fiser

2 Answers

1
votes

You just need to declare it as [AnyObject]:

var people:[AnyObject] = [[1, "Breta", 3],[2, "Brunda", 3],[3, "Antonin", 3],[4, "Andolf", 3],[5, "Barborka", 2],[6, "Boruvka", 2],[7, "Anicka", 2],[8, "Antonin", 3],[9, "Andolf", 3],[10, "Barborka", 2],[11, "Boruvka", 2],[12, "Anicka", 2],[13, "Antonin", 3],[14, "Andolf", 3],[15, "Barborka", 2],[16, "Boruvka", 2],[17, "Anicka", 2],[18, "Antonin", 3],[19, "Andolf", 3],[20, "Barborka", 2],[21, "Boruvka", 2],[22, "Anicka", 2],[23, "Antonin", 3],[24, "Andolf", 3],[25, "Barborka", 2],[26, "Boruvka", 2],[27, "Anicka", 2],[28, "Andulka", 2]]
0
votes

If you wait long enough it will finish, you just have to deal with it right now. Swift is extremely slow, this kind of stuff should be fixed in swift 1.2. It's in beta right now with iOS 8.3.