styler1972 styler1972 - 2 years ago 232
Swift Question

Unit testing Swift 2.0, @testable import, and scheme targeting issues

I have recently converted my app, and unit tests over to Swift 2.0. I am using

@testable import AppName
in my Tests.swift files.

Due to an issue with not being able to execute subclasses in multiple targets (see here for the issue), my class
can only be of Target Membership
, and NOT

The problem is, once I switch over to the
schema to run unit tests, code in the module
can't find the class
and I get

Use of undeclared type 'EntityName'

How do I get
to compile when running tests from the
scheme without that entity class not a member of the scheme?

Answer Source

I had to stop targeting my entire apps .swift files to be have membership of MyAppTests, and rely solely on @testable import MyApp

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download