Hello everyone!
I am glad to say that I have finally fixed a bug in our working project.
As some of you have mentioned earlier, the issue can arise when Xcode indexing fails, especially when the group filename in Xcode and folder name in the filesystem are different. However, I double-checked this and found that it was not the cause of our issue. So, I took the following steps:
I turned on the index log in XCode by running the following command in Terminal: defaults write com.apple.dt.Xcode IDEIndexShowLog -bool YES.
After that, I went to the log tab on the left bar and found the Index section. In the index log, I discovered an error that said the compiler couldn't find the Moya module for the x86-64 processor, even though it found it for the arm64. But I have an arm64 M1Pro chip. So, the reason it was trying to find the x86-64 version of lib was hiding in BuildSettings.
I found that I had set arm64 as excluded archs in BuildSettings when I had an issue with libraries that weren't ready to compile to arm64 sim. But now that all project dependencies are ready, I only needed to remove that setting.
And that's it! The errors are no longer hidden from me.
P.S. If you are using Xcode 14.3, you may also need to remove that setting because it no longer supports the Rosetta environment.
In short, to fix the issue, remove "Excluding archs: arm64" from the target BuildSettings.
I hope this helps!