tompitt
tompitt

Reputation: 410

Cannot see Swift classes from test target

I have an iOS app using both ObjC and Swift code. I tried setting up a test target for it today with no success. I have a single test case class written in Swift. I imported my app's module there. I made sure the classes I am trying to access are public. But I cannot see them from my test target. I can see ObjC code from there though.
I tried the exact same steps on a dummy project and there it worked fine.
I don't want to add the classes for testing to the test target's compile sources. I am also using Xcode 6.3 and updating to Xcode 7 is not an option for me at the moment.
Any ideas on what I am doing wrong?

Upvotes: 2

Views: 2418

Answers (2)

tompitt
tompitt

Reputation: 410

The issue went away after deleting and recreating the test target.

Upvotes: 0

colavitam
colavitam

Reputation: 1322

Make sure your import is marked with a @testable annotation. For example, you want:

@testable import myprojectname

as opposed to:

import myprojectname

Upvotes: 4

Related Questions