OK, I've found a solution:
Xcode can mess with pbxproj file and can:
- break references
- leave obsolate references dangling
Close Xcode. Save your pbxproj file for sure.
I downloaded this tool: https://github.com/americanexpress/xcprojectlint
~/xcprojectlint --project XXXX.xcodeproj --report error --validations files-exist-on-disk
You should be watching for output like this:
/project.pbxproj:0: error: XXXXX/Vendor references files that are not on disk.
Open the the pbxproj file and search for the folder indicated above (Vendor). Check all references under children of it and delete all obsolate ones.
Clean DerivedData. Open the workspace again. Try to compile. Fix any errors. Re-add missing files is needed.
The sad thing is that Xcode does not always fully follow up refactors, moving files/folders. The project still compiled though, but after fixing the pbxproj file many errors occured. This can be dangerous, so using xcprojectlint help a lot.