I managed to solve the issue by going to: Xcode > Settings > Locations as below:
and sat the Derived Data location to Relative
Note: Adding a preceding dot is optional, I only added it to hide the folder and ignore it it the repo by adding this **/.DerivedData/ to the .gitignore file
Topic:
Developer Tools & Services
SubTopic:
Xcode