title: Accessing ObjC #define BOOL YES/NO from Swift
body: <p>I have a codebase with many hundreds of ObjC #defines for settings in an iOS App. e.g.</p>
  <p><code>#define kSettingName NO</code></p>
  <p>However, these are seemingly not visible to Swift code (not in scope error) as I'm adding new Swift code to the codebase that still needs to access all of these settings (as does the old ObjC code). Is there a good way to have these many settings visible in Swift?</p>
  <p>So far, the best way I've come up with is find/replacing YES/NO with true/false (which makes them visible to Swift, but then, you can't easily do:</p>
  <p><code>if kSettingName { }</code></p>
  <p>in Swift. I could write an Int32 extension:</p>
  <pre><code>extension Int32 {
      
      var isTrue: Bool { return self != 0 }
      
      static func == (lhs: Int32, rhs: Bool) -&gt; Bool {
          if rhs {
              return lhs != 0
          } else {
              return lhs == 0
          }
      }
      
  }
  </code></pre>
  <p>Which leads to being able to use either</p>
  <p><code> if kSettingName.isTrue { }</code></p>
  <p>or</p>
  <p><code>if kSettingName == true { }</code></p>
  <p>but both are a little less nice than just</p>
  <p><code>if kSettingName { }</code></p>
  <p>Does anyone have any better ideas here?</p>