The solution recommended by Steve Rosenberg is simple, but leads to problems that are difficult to debug (a copy of which is documented here if you're interested).
The recommended approach is to edit the purpose of your application (not the target audience) and configure "Define module" in the "Packaging" section YES .
At the same time, in the test target at the top of each .swift file, import the main module of your projects to gain access to your classes, structures, etc. The name of the main module usually matches the name of your Xcode project file.
Note When implementing this approach, you will need to annotate all the class / struct / enum methods that you want to test using the public access control modifier.
Pasan Premaratne Apr 03 '15 at 16:15 2015-04-03 16:15
source share