I did not find a way to unit test an internal swift class that is inside a framework. It only works if I set the class scope to public. Is there a way around it ?
Here is what I have now:
In the framework:
class InternalClass {}
In the tests:
import XCTest
@testable import MyFramework
class InternalClassTests: XCTestCase {
let sut = InternalClass() //ERROR HERE Use of unresolved identifier 'InternalClass'
}
If you want to use your InternalClass
as internal class, you must add your InternalClass
to your UnitTest
target.
You can simple do it by click to the checkbox of the Unit Test target, in the file's Target Membership
. (select your file and find it in the Inspectors
bar)