index(of:) works fine with ChecklistItem types since the code in the book was verified at the time of writing the book You can always try compiling the included sample projects for each chapter to see if the sample project shows the same issue you’re seeing. If not, then the issue is somewhere in your code.
If the sample project does show the same error, then let me know the Xcode version that you’re using since I just tested with the latest Xcode (9.3) and the code compiles fine without any issue at this end.
Hey Fahim, so i compared my project to the sample project and when creating the ChecklistItem class it didn’t say in my copy of the book to inherit from the NSObject class. I also did some more research and found that index(of:) doesn’t work on custom types unless they conform to the Equatable protocol.
Thanks for the quick reply, i’m really new to the whole forums idea and normally feel uncomfortable to ask a question.
Edit: Just realised it does address this error later on in the book
I was just about to tell you that page 313 covers that issue - I am going by the PDF file page numbers since they are the only ones which remain constant. If you are using the EPUB version, the page numbers might be different.
And don’t feel uncomfortable about asking questions - the forums are there just for you to clarify things that you might not understand. So use them