I always face with this issue and solve it by resetting or resolving packages. Sometimes clearing derived data or reopening Xcode works just fine. However this time my issue didn't solved by these. The problem was a misconfigured swift package. After deleting the broken package, everything went back to normal.
So If solutions above not working, check your packages.