Search code examples
iosxcodexcode10

Xcode 10 Tests target build errors


No matter what I do, I get some error or the other in MyApp-SwiftTests target. This is happening on upgrading to XCode 10/Swift 4.2. The error I got initially was "Failed importing Module with name MyApp-Swift", and on reading various answers on SO, I changed Product Module Name and Product Name to $(TARGET_NAME). But now the error is:

  <unknown>:0: error: module name "MyApp-SwiftTests" is not a valid identifier
  Command CompileSwiftSources failed with a nonzero exit code

How do we avoid build errors in Tests target?


Solution

  • As you mention, in "MyApp-SwiftTests", dash is not allowed. Use "MyApp_SwiftTests" will solve your problem.