Dustin Spengler Dustin Spengler - 4 years ago 122
Swift Question

Swift find() method throwing error

When i opened my app today, Xcode asked if i wanted to update some syntax. I followed through the update prompts and after all was said and done my app now has this error on one of the "find" methods. Ive been scratching my head over this one for about an hour now. Any advice on what might have changed?


Answer Source

As discussed here, Swift 2.0 removed the find method and replaced it with indexOf (as indicated by the error Xcode is giving you).

You can fix your code as follows:

if let index = playlistArray.indexOf(playlistImageView)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download