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 Refactoring Our Code Passing Playlist Objects Using Segues

Martial Gil
Martial Gil
771 Points

I can't put the array after find() (with swift 1st),can you help me please.

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "sehe" { let imageView = sender!.view as! UIImageView if let play = find(playlistArray, imageView){

        }

this my code, and Xcode say me that "use an unresolved identifier 'playlistArray'"

2 Answers

Tyler Rolfe
Tyler Rolfe
2,882 Points

the find() function is not longer supported in Swift 2.0.

Instead try this..

if let index = playlistArray.indexOf(playlistImageView)

Chung-En Hsu
Chung-En Hsu
3,761 Points

Thank you very much!!!!!!

Mike Gomes
Mike Gomes
15,391 Points

Thanks Tyler Rolfe!

I was facing the same problem and your solution worked well for me as well :)