"Close Xcode and restart." it worked for me. I have the same problem with Xcode-9.0. I tried it in several ways, for example, deleting Derived data, clearing the project and closing Xcode, but nothing worked.
Delete your derived data and then close the code X Cmd + q exit xcode and reopen it.
source share