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 Struct Initialization

Jimmy Fisher
seal-mask
.a{fill-rule:evenodd;}techdegree
Jimmy Fisher
iOS Development Techdegree Student 3,183 Points

Cannot subscript a value of type '[NSDictionary]'

I am receiving an error of cannot subscript a value of type '[NSDictionary]' with an index type of type '(UnsafePointer<Int8>, Int32) -> UnsafeMutablePointer on line 3 below

1 Init(Index: Int) { 2 let musicLibrary = MusicLibrary().library 3 let playlistDictionary = musicLibrary[index]

2 Answers

Is that due to the difference between Index and index? Change the capital I to a lowercase one.

Without the rest of the code, it's hard to say what the issue is.

I'd say you want to use the lowercase version of index in both places.

Steve.

No problem! :-)