For me this issue occurred after I cleaned my DerivedData folder. I thought it was supposed to simply rebuild the necessary files/folders.
I managed to fix it by changing Derived Data location to Custom Location. Steps;
In XCode -> File -> Workspace Settings -> Derived Data: from Default Location to Custom Location. I created a folder named DerivedData in my Documents section and chose that one.