When those simple annoyances are too frustrating! Yes we have all been there and I was really hoping that Apple would have fixed what is obviously a bug.
Historically I have found Core Data annoying to work with... so for a while now I have been managing the database using Realm. However, with Realm now significantly bloating (553MB) and the Realm Browser app on OSX no longer usable, it was time to visit my old friend. With open arms it tripped me up straight away. I had deleted the cursory Item entity and added a new entity named Person. With that change I was greeted with Cannot find 'Person' in scope. As I had deleted Item, even if I added that back in to the code - correctly the error was Cannot find 'Item' in scope. At least I had something working. Or was it really working for me...
I needed to give Xcode a good clean.
The clearing process I did to get it running again was:
Clean build folder (shift + command + k) Close Xcode completely Delete 'DerivedData' content (/Library/Developer/Xcode/DerivedData) Open Xcode and your project again Try to build and run it again
Deleting derived data
Run the following command to delete the contents of your DerivedData directory, replacing {your-name}:
rm -rf /Users/{your-name}/Library/Developer/Xcode/DerivedData/*