The file couldn't be opened because you don't have permission to view it
Today I turned on my computer and discovered that all my projects show this error for each file in a project. Some of my projects have third-party libs, some don't. I checked all answers in this question, but none of that helped. Also I tried to reinstall Xcode following this article, it also didn't have an effect.
Of course I tried to reboot my mac and I changed permissions as Xcode asked but it didn't help. As I discovered it is a very common error that can occur for very different reasons. Yesterday everything worked fine, I didn't update macOS or Xcode, but it started getting these errors after turning on the computer.
System: macOS Catalina 10.15.1
Xcode: 11.2.1 (after reinstall, before that Xcode had lower version)