Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Array of Dictionaries causing Source Kit Service CPU overload

After some research i have found that the array of dictionaries I have created in my latest project is causing Xcode to run very slowly - due to Source Kit Service taking up all of my CPU.

After more research it seams one answer is to declare my array types when creating the array, however, I'm finding the array I've created too complicated! Can someone help?

Here is the array, it only has 2 indexes, Dictionaries that contain strings and arrays of more dictionaries.

let library = [
    [   "title": "Week 1",
        "icon": "week1",
        "backgroundColor": ["red": 255, "green": 204, "blue": 51, "alpha": 1.0],
        "day1Rest": "60",
        "day2Rest": "90",
        "day3Rest": "120",
        "day1": [["set1":"2", "set2":"3", "set3":"2", "set4":"2", "set5":"max (at least 3)"], ["set1":"6", "set2":"6", "set3":"4", "set4":"4", "set5":"max (at least 5)"], ["set1":"10", "set2":"12", "set3":"7", "set4":"7", "set5":"max (at least 9)"]],
        "day2": [["set1":"3", "set2":"4", "set3":"2", "set4":"3", "set5":"max (at least 4)"], ["set1":"6", "set2":"8", "set3":"6", "set4":"6", "set5":"max (at least 7)"], ["set1":"10", "set2":"12", "set3":"8", "set4":"8", "set5":"max (at least 12)"]],
        "day3": [["set1":"4", "set2":"5", "set3":"4", "set4":"4", "set5":"max (at least 5)"], ["set1":"8", "set2":"10", "set3":"7", "set4":"7", "set5":"max (at least 10)"], ["set1":"11", "set2":"15", "set3":"9", "set4":"9", "set5":"max (at least 13)"]]
    ],
    [   "title": "Week 2",
        "icon": "week2",
        "backgroundColor": ["red": 255, "green": 102, "blue": 51, "alpha": 1.0],
        "day1Rest": "60",
        "day2Rest": "90",
        "day3Rest": "120",
        "day1": [["set1":"4", "set2":"6", "set3":"4", "set4":"4", "set5":"max (at least 6)"], ["set1":"9", "set2":"11", "set3":"8", "set4":"8", "set5":"max (at least 10)"], ["set1":"14", "set2":"14", "set3":"10", "set4":"10", "set5":"max (at least 15)"]],
        "day2": [["set1":"5", "set2":"6", "set3":"4", "set4":"4", "set5":"max (at least 7)"], ["set1":"10", "set2":"12", "set3":"9", "set4":"9", "set5":"max (at least 13)"], ["set1":"14", "set2":"16", "set3":"12", "set4":"12", "set5":"max (at least 17)"]],
        "day3": [["set1":"5", "set2":"7", "set3":"5", "set4":"5", "set5":"max (at least 8)"], ["set1":"12", "set2":"13", "set3":"10", "set4":"10", "set5":"max (at least 15)"],  ["set1":"16", "set2":"17", "set3":"14", "set4":"14", "set5":"max (at least 20)"]]
    ]
            ]