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

What is the best way to append Swift Dictionaries together?

I'm having a lot of trouble hard coding a library (by appending numerous dictionaries together) for my application. Would some one be able to tell me why this way of appending dictionaries is wrong? Also what's is the most efficient way to append dictionaries?

var timeLibrary = [

[

    "Monday" : [
        "happyHourStart": 16,
        "happyHourEnd": 19


    ],

    "Tuesday" : [
        "happyHourStart": 16,
        "happyHourEnd": 19


    ],

    "Wednesday":[
        "happyHourStart": 16,
        "happyHourEnd": 19

    ],

    "Thursday": [
        "happyHourStart": 16,
        "happyHourEnd": 19

    ],

    "Friday" :  [
        "happyHourStart": 16,
        "happyHourEnd": 19

    ],

    "Satuday" : [
        "happyHourStart": 16,
        "happyHourEnd": 19


    ],

    "Sunday" :  [
        "happyHourStart": 16,
        "happyHourEnd": 19

    ]
],

    [

    "Monday" : [
        "happyHourStart": 15,
        "happyHourEnd": 20


    ],

    "Tuesday" : [
        "happyHourStart": 15,
        "happyHourEnd": 20,
        "entStart": 22,
        "entEnd": 2

    ],

    "Wednesday":[
        "happyHourStart": 15,
        "happyHourEnd": 20,
        "entStart": 22,
        "entEnd": 2

    ],

    "Thursday": [
        "happyHourStart": 15,
        "happyHourEnd": 20,
        "entStart": 22,
        "entEnd": 2

    ],

    "Friday" :  [
        "happyHourStart": 15,
        "happyHourEnd": 20,
        "entStart": 22,
        "entEnd": 2
    ],

    "Satuday" : [
        "entStart": 22,
        "entEnd": 2

    ],
    "Sunday" :  [
        "entStart": 22,
        "entEnd": 24
    ]
]

]

I've tried defining each library separately and then used the member function ".append(libraryName)" but the compiler tells me that my data type is anything but a NSDictionary so I can't use ".append()".