“Use of undeclared type” in Swift, even though type is internal, and exists in same module

For me, I encountered this error when my test target did not have some swift files that my app build target had in compile sources. It was very confusing because the ‘undeclared type’ was being used in so many other places with no problem, and the error seemed vague. So solution there was of course to add the file containing the ‘undeclared type’ to the test target.

Leave a Comment