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 trialChristiaan Hendriksen
5,982 PointsAmbiguous reference to member 'view'
My app is crashing on the line:
let playlistImageView = sender!.view as UIImageView
with an error of:
Ambiguous reference to member 'view'
I've tried googling, but I have no idea what this means!
1 Answer
Sam Davis
6,988 PointsI have gotten it working with the following code:
if let playlistImageView = sender!.view! as? UIImageView {
if let index = playlistsArray.indexOf(playlistImageView) {
if let playlistDetailViewController = segue.destinationViewController as? PlaylistDetailViewController {
playlistDetailViewController.playlist = Playlist(index: index)
}
}
}
My guess is that Swift has changed a little bit since this video was made.
Christiaan Hendriksen
5,982 PointsChristiaan Hendriksen
5,982 PointsI've made it build by changing the line to:
let playlistImageView = sender!.view! as! UIImageView
But this seems like a hack rather than a solution...