When you perform a rename of something (it can be any object), right click on the name and from the menu that pops up, select Refactor > Rename
Xcode will search for every occurrence of that name in your code and by changing the one you initially selected you will see that change take effect throughout. It reduces the chances of missing anything.
If it is the name of a .swift file like ContentView, for example, you will see that the filename is also included and where it finds that same name in a comment, it will list that as a possible change but you have to hover the cursor over it till you see a + symbol appear, then tap that + so that it is included.
That said, there have been instances where I have had to restart Xcode since it wasn’t able to resolve what should be been the obvious. If you have been using Xcode for some hours there is a chance that it’s getting a little messy in memory and you can generally tell when it isn’t doing what you expected or throws up peculiar errors.