Xcode - Test class File is part of module, ignoring import
I just stumbled on the same problem, and your post was helpful. What I found out is by change the Product Name
to AppNameTests
, as per your example, then the product module name is reflected correctly and you don't have to add Tests
at the end of $(PRODUCT_NAME:c99extidentifier)
. c99extidentifier
seems torefers to Product Name
.
Summary:
- select your test target in Project
- navigate to
Build Settings -> Packaging
- change the
Product Name
to your previous test target, likely appendingTests
- I believe the rename as per Apple's renaming a project doesn't include the updating the module in
@testable
, so I had to do this manually
Xcode Ignoring import
Your project is named SwiftUI
- please try using a different name.
file viewController.swift is part of module coreData ignoring import
Is your project name "CoreData" ? You can't call your project with the name of a module. Try creating another project with another name
Xcode: File 'GameViewController.swift' is part of module 'SceneKit'; ignoring import
This issue has nothing to do with the template. A very common mistake that (I made too) is to name the project same as one of the using frameworks! (e.g. CoreData
, SwiftUI
, SceneKit
, Metal
)
Solution
Don't name your project same with another module. Change it to anything else.
Note that It could be appear as error too. For example if you name your project CoreData
and using SwiftUI, the error appears as Circular dependency error
:
Circular dependency between modules 'CoreData' and 'SwiftUI'
Because Xcode gets confused about modules and can not detect what the real issue is.
Related Topics
Avaudioconverter with Avaudioconverterinputblock Stutters Audio After Processing
How to Compare Two Dates (Nsdate) in Swift 3 and Get The Days Between Them
Move Button When Keyboard Appears Swift
Why How to Make Same-Type Requirement in Swift with Generics? Is There Any Way
Convert Single File to Swift 3 in Xcode 8
Is There Any Difference at All Between Suffix(From:) and Dropfirst(_:)
Navigation Bar Items After Push from Swiftui to UIkit
Swift Error "Domain=Nscocoaerrordomain Code=3840 "Invalid Value Around Character 1."
Cannot Convert Value of Type 'X' to Expected Argument Type 'X'
Nstoolbarflexiblespaceitem Is Constraint to Nssplitviewitem in Swift
Uibutton Action Is Not Triggered After Constraint Layouts Changed
Which Optimization Level Should I Choose for Release
Naming Convention for Private Properties
Why Is Inceptionv3 Machine Learning Model Not Recognized on My Project
A Concise Way to Not Execute a Loop Now That C-Style for Loops Are Going to Be Removed from Swift 3
Swift Difference Between Double and Float64
Xcodebuild Commands Failed to Generate Ipa
Performseguewithidentifier Not Working If Called from Viewdidload