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 Using a Navigation Controller With Segues Modifying the UI

Suresh Koppisetti
Suresh Koppisetti
3,234 Points

The label on the PlaylistDetailViewController is not updating per the instructions in this video.

Hi, I have followed the instructions in the lesson to create the variable in the PlaylistDetailViewController to pass information from the master view to the detail view. However this did not work for me. Below is the sample of the code. When I run my project I see the "buttonPressLabel" set to "Testing..." instead of "Testing 1 2 3".

class PlaylistMasterViewController: UIViewController {
....
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        if segue.identifier == "showPlaylistDetail" {
            let playlistDetailController  = segue.destinationViewController as PlaylistDetailViewController
            playlistDetailController.segueLabelText = "Testing 1 2 3!"
        }
    }
}
class PlaylistDetailViewController: UIViewController {
....
    var segueLabelText: String = "Testing..."
    override func viewDidLoad() {
        super.viewDidLoad()
        buttonPressLabel.text = segueLabelText
    }
}
Suresh Koppisetti
Suresh Koppisetti
3,234 Points

Aaron, I actually don't get an error. The code is compiling and when I click the button on the master page which should update the label's text on the detail page, that isn't happening as I expected after watching the video.

Thanks

Check the identifier in the storyboard. Make sure it set to "showPlaylistDetail" and not "showPlaylistDetailSegue"

2 Answers

Hello Suresh Koppisetti. Can you tell me what error message you are getting?

I also noticed that your identifier is "showPlaylistDetail" check to make sure it should not be "showPlaylistDetailSegue"

Suresh Koppisetti
Suresh Koppisetti
3,234 Points

Aron, thanks a lot. I had a typo in the name I was using to reference my segue. This is working now.

Thanks again. Suresh

Glad to help!

Brendan O'Brien
Brendan O'Brien
5,521 Points

HOLY COW! I had exactly the same problem but it was INVISIBLE. I only discovered the problem when I copied the segue identifier field and paste it into the code. There was an extra space after the name! Oy! Copying and pasting the complete seque identifier field is what solved the problem. ARGH!