I don't know if the solution is correct but following these steps my problem was solved. I am using Xcode 13.2.1
File > Packages > Reset Package Caches
then command + shift + k and command + b
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: