title: Conditional compiling in Swift
body: <p>I want to use flags to control the compiler in Swift. Like we use #ifdef, #ifndef, #else, #endif in C (and C++, Objective C, ....)</p>
  
  <p>I found the way to do it on the net, but I hit a problem in the following case. Anyone reading will understand what I want.
  Nevertheless the compiler complains. What is the way to go around? Of course without having to copy two times the same ten or more lines.</p>
  
  <pre><code>#if UseAds
  class ViewController: UIViewController,XYZBannerDelegateProtocol {
  #else
  class ViewController: UIViewController {
  #endif
  </code></pre>
  
  <p>Note that I got the information I am using here:
  <a href="http://en.swifter.tips/condition-compile/" rel="nofollow noreferrer">http://en.swifter.tips/condition-compile/</a>
  which is similar to what can be found <a href="https://stackoverflow.com/questions/38813906/swift-3-how-to-use-preprocessor-flags-like-if-debug-to-implement-api-keys">here</a>.</p>
  
  <p>But none of these solves my problem. They only tell me the basic way to do it.</p>