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 Using a Playlist Instance

Myles Binford
Myles Binford
8,442 Points

Getting unresolved identifier that I can't sort out.

'largeIcon' is the unresolved identifier. Here is the code:

let largeIconName = playlistDictionary["largeIcon"] as String!

largeIcon = UIImage(named:iconName)

1 Answer

Michael Hulet
Michael Hulet
47,912 Points

I haven't taken this course yet, so I can't be sure if largeIcon was previously defined, but I'm guessing not. You probably either need to declare it as a variable or constant (preferably constant), like this:

let largeIconName = playlistDictionary["largeIcon"] as String!
//Notice the let keyword below, and I also think you misnamed the variable you're initializing the UIImage with, so I fixed that, too
let largeIcon = UIImage(named:largeIconName)