This happens after moving the swift files around.
Solution: simply quit Xcode and reload so that it can re-source the new location of the files.
Or command + B to rebuild. Sometimes those formatting errors are just not caught up and not rebuilt yet.