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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![maq](https://secure.gravatar.com/avatar/b05a40c9694ea08b41c83710e39656fa?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
maq
1,297 PointsUse of unresolved identifier 'musicLibrary'
I keep getting "Use of unresolved identifier 'musicLibrary'" in the init function. I've followed the teacher as best as I could and am not sure what I'm doing wrong. Here's my code for that function, I would appreciate any help:
init(index: Int) {
let musiclibrary = MusicLibrary().library
let playlistDictionary = musicLibrary[index]
title = playlistDictionary["title"] as String!
description = playlistDictionary["description"] as String!
let iconName = playlistDictionary["icon"] as String!
icon = UIImage(named: iconName)
let largeIconName = playlistDictionary["largeIcon"] as String!
largeIcon = UIImage(named: largeIconName)
artists += playlistDictionary["artists"] as [String]
let colorsDictionary = playlistDictionary["backgroundColor"] as [String: CGFloat]
backgroundColor = rgbColorFromDictionary(colorsDictionary)
}
1 Answer
Fabio Mingorance
3,520 PointsIt is probably that you just mispelled the variable name. You first instantiated the variable as musiclibrary (l) and then assigned the variable musicLibrary (L). Swift if case sensitive.
![maq](https://secure.gravatar.com/avatar/b05a40c9694ea08b41c83710e39656fa?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
maq
1,297 PointsThank you! I did not even catch that.
Jhoan Arango
14,575 PointsJhoan Arango
14,575 PointsHello:
I edited your question so that your code is readable!