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?
Asked
Active
Viewed 72 times
-3
-
maybe you should post the code in question, the error you got, etc. – pvg Dec 24 '15 at 19:42
-
You updated Xcode to 7.x – Leo Dabus Dec 24 '15 at 19:44
-
3Actually the error message tells you exactly what to do – vadian Dec 24 '15 at 19:44
-
@vadian like this? `if let index = indexOf(playlistArray, playlistImageView) ` – Dustin Spengler Dec 24 '15 at 19:50
-
`method calling on object` means `object.method()`, see my answer – vadian Dec 24 '15 at 19:52
2 Answers
1
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)
0
Read the error message carefully. It says
find(haystack, needle)
is unavailable, call haystack.indexOf(needle)

vadian
- 274,689
- 30
- 353
- 361