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 Master and Detail Views Displaying Playlist Information

Noah Schill
Noah Schill
10,020 Points

Nothing is updating?

When I run my app, the labels and the ImageView doesn't change to the data from the Playlist.

2 Answers

Noah, without seeing your code, I can not determine the problem. If could post your detail view controller file on this post I would love to help you debug the problem. If you are unable to do so, try download the files from the video at your current progress. All downloads are error free!

If you have any questions, feel free to ask!

William Hughes
William Hughes
1,949 Points

When I run the playlist browser app...my detail view controller does not display the title and description at all. The reason seems to be from not being able to get the data from the Playlist model. I downloaded your code and tried to run it, but there were several compiler errors...

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)

}

The errors are that AnyObject? is not convertible to type String. It wants me to force unwrap the as (as!)... Like I said the code was downloaded from your site and is untouched with the compiler errors. The same happened to me when I tried to follow Pasan. It forced me to add the bang at the end of each 'as' and now the title and description will not display in the Detail View Controller when I run the app. What is going on here?

Noah Schill
Noah Schill
10,020 Points

My error was that I had some issues with the IBOutlets. I deleted them both in the storyboard as well as in my view controller and now they are fine.