This might have come in late but wanted to post it nonetheless as it may help someone else in future. I too experienced the same error when trying to build my app.
For my case I had added two Swift files with the same name. Renaming one of the files to have a different name solved the issue. So ensure your files do not have the same name.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: