title: iOS Xcode SPM failed to demangle superclass
body: <p>My app is composed of many projects (frameworks), one for each main feature and a common framework with all sorts of things that I need to access in multiple of my features.</p>
  
  <p>I'm using Xcode 11's Swift Package Manager to add dependencies.</p>
  
  <p>The common framework contains a RxSwift dependency, which I use throughout the whole project.</p>
  
  <p>I'm facing problems when I try to use RxTest in any of my feature frameworks.</p>
  
  <p>If I add RxTest via SPM to the test target directly and run the tests, I get</p>
  
  <blockquote>
    <p>failed to demangle superclass of 'class name' from mangled name 'other class name'</p>
  </blockquote>
  
  <p>and many </p>
  
  <blockquote>
    <p>Class 'class name' is implemented in both 'common framework path' and 'test target path'</p>
  </blockquote>
  
  <p>where all these classes are Rx related. The 'failed to demangle' error crashes the test and only occurs when I try to initialize a RxTest class.</p>
  
  <p>If I add RxTest to the common framework, the tests run fine, but when I run the app, I get </p>
  
  <blockquote>
    <p>dyld: Library not loaded: @rpath/XCTest.framework/XCTest</p>
  </blockquote>
  
  <p>Which makes sense, because I'm adding a test framework to a non-test framework, and it's not something good to do.</p>
  
  <p>So basically, I wasn't able to get a configuration where both the tests and the app run fine. Either the app runs or the tests run.</p>
  
  <p>How can I get this working? Is there a way to include RxTest on the common framework only when I build it on a test target? Or should RxTest only be included on the test targets and I'm missing some configuration?</p>