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 Build a Playlist Browser with Swift Building the Music Library and Playlist Models Creating a Data Model

I am very stuck here.

I'm not sure exactly where I've gone wrong.

ChocolateBox.swift
struct ChocolateBox {

var caramelDelight: [String] = []
var flavor: String = "caramel"  

}

1 Answer

Richard Lu
Richard Lu
20,185 Points

Hi James,

I see that you're up to the second part of the challenge which consist of the following parts:

  • Create a stored property named caramelDelight
  • add a key named flavor that stores a value named caramel to the caramelDelight dictionary to initialize it

So to create the stored property, all you have to do is:

struct ChocolateBox {
   let caramelDelight 
}

But if you take a look at the other part of this challenge, you must add a key named flavor and the value named caramel. Here's what you get when you add those values onto the dictionary initialization.

struct ChocolateBox {
   let caramelDelight = ["flavor": "caramel"]
}

And there you have it! Challenge solved! Happy coding! :)