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 trialJohn Streeter
2,036 PointsTap Gesture Recognizers not going to different Playlist array values
I added the Tap Gesture Recognizers to each playlistImageView. I then CTRL + dragged each to the @IBAction method in the PlaylistMasterViewController file until it said "Connect", and let go.
When I run the app, each item I click just acts like I clicked playlistImageView0 instead of 1-5, and just shows that first screen on the PlaylistDetailViewController.
I have no idea what I might have done wrong here, all the code appears to be the same as the videos' ...
Any ideas?
1 Answer
John Streeter
2,036 PointsFound it. I still had an [index: 0] referenced in my prepareForSegue method:
let playlistDetailController = segue.destinationViewController as PlaylistDetailViewController
playlistDetailController.playlist = Playlist(index: 0)
}
Changed it to:
let playlistDetailController = segue.destinationViewController as PlaylistDetailViewController
playlistDetailController.playlist = Playlist(index: index)
}