title: Can I write a Swift enum case that's only available in Objective-C?
body: <p>In Swift, I have this enum:</p>
  
  <pre><code>enum Foo: UInt8 {
      case bar
      case baz
  }
  </code></pre>
  
  <p>I want to give it a failable initializer:</p>
  
  <pre><code>extension Foo {
      init?(byName name: String) {
          if name == "bar" {
              self = .bar
          }
          else if name == "baz" {
              self = .baz
          }
          else {
              return nil
          }
      }
  }
  </code></pre>
  
  <p>Obviously, this can't be exposed to Objective-C, so the traditional solution is to use a new case like this:</p>
  
  <pre><code>enum Foo: UInt8 {
      case invalid = 0
      case bar
      case baz
  }
  </code></pre>
  
  <p>This isn't something I want. I don't want someone to use <code>.invalid</code> in Swift when <code>nil</code> does just fine. I was hoping I could do something like this:</p>
  
  <pre><code>enum Foo: UInt8 {
      #if objc
          case invalid = 0
      #endif
      case bar
      case baz
  }
  </code></pre>
  
  <p>But that doesn't seem to do the job. <strong>Is there any way I can write code in Swift that can only be seen and used in Objective-C?</strong> That is, is there any way to write code in Swift that's only ever exposed in the generated <code>MyModule-Swift.h</code> file?</p>