Leguman
Leguman

Reputation: 2114

How to access Swift files from main target in test target

I'm implementing some tests and I need to access the source files from my main target.
Do I need to add all required files in "Compile Sources" ?

Upvotes: 1

Views: 1285

Answers (2)

Sunset Wan
Sunset Wan

Reputation: 23

You can also use @testable import ${app target name} in your test file written in swift.

Upvotes: 0

Kirsteins
Kirsteins

Reputation: 27345

Yes you need to add them in "Compile Sources". Alternatively you can select file in "Project Navigator" and change target membership in "Utility -> File Inspector" pane on right side of Xcode window.

Upvotes: 1

Related Questions