I have macOS Big Sur (11.4)
What helped me is related to the fact I copied my project from another Mac. I have quit Xcode, then right clicked the project folder in Finder > Get Info > Unlock padlock in the bottom, right corner of the window that opened, I expanded Sharing & Permission section > selected my username which says Read & Write > Apply permissions.
This effectively gives me / fixes full access right to the folder and fixes the problem.