Q:

How to enable testability for Framework in Release mode?

I have an iOS app project, written by Swift 3.0
the workspace contains a dynamic framework build by our team, for sharing reusable codes and resources all across the Project.
We use Activate Compilation Conditions for switching production server url and beta server url, like this:
#if DEBUG
let url = "http://my-beta-server-url"
#else
let url = "http://my-production-server-url"

So that when app is Archived, the url will switch to production server url.
And when debugging, we can use the beta server for development.
We have an unit test target for testing this framework.
Recently we'd want to add a simple sanity test for checking whether the url is correct in Release mode.
If we want to test for this behavior, we'll have to set the Build configuartion flag to Release for the Test target.
When setting it to Release, Xcode compiles for error:
Module XXXXFramework was not compiled for testing
To solve this problem, we can just simply set Enable Testability for Release to Yes for our framework.
However, the issue is that Apple does not recommend setting Enable Testability to Yes for Release mode according to this note

Testability: Tests of Swift 2.0 frameworks and apps are written
  without having to make internal routines public. Use @testable import
  {ModuleName} in your test source code to make all public and internal
  routines usable. The app or framework target needs to be compiled with
  the Enable Testability build setting set to Yes. The Enable
  Testability build setting should be used only in your Debug
  configuration, because it prohibits optimizations that depend on not
  exporting internal symbols from the app or framework. (17732115)

Does anyone have suggestions for solving my problem, or, any alternative solutions to achieve my goal?
For testing a framework using Release mode

A:

I created a sample project for you. Your setup might be different, but this sample project will demonstrate how to test the release url and debug url, go through the edit scheme settings. Here is the link https://github.com/borg666/ios-multi-scheme-config-example
Basically the trick is to have another scheme in which debug flag is disabled and it runs a separate test file where you can test the release url, By doing this you are free to enable testability on this scheme. 
You might consider having user defined variable for the url, with my example you can achieve more complex configurations.

