title: Implement RCTEventEmitter in Swift but receive exception for bridge is not set
body: <p>I am trying to implement an event emitter for React Native in Swift so that I can reuse it across some of my native modules. However, when I send event natively from iOS, I received the following error</p>
  
  <pre><code>Bridge is not set. This is probably because you've explicitly synthesized the bridge in MyEventEmitter, even though it's inherited from RCTEventEmitter.
  </code></pre>
  
  <pre class="lang-c prettyprint-override"><code>/// MyEventEmitter.m
  #import &lt;Foundation/Foundation.h&gt;
  #import &lt;React/RCTBridgeModule.h&gt;
  #import &lt;React/RCTEventEmitter.h&gt;
  
  @interface RCT_EXTERN_MODULE(MyEventEmitter, RCTEventEmitter)
  
  RCT_EXTERN_METHOD(supportedEvents)
  
  @end
  </code></pre>
  
  <p>Implementation in Swift:</p>
  
  <pre class="lang-swift prettyprint-override"><code>import Foundation
  
  @objc(MyEventEmitter)
  class MyEventEmitter: RCTEventEmitter {
  
      public static let shared = MyEventEmitter()
  
      override func supportedEvents() -&gt; [String]! {
          return [
              ... // my event list
          ]
      }
  }
  </code></pre>
  
  <p>In my native swift code, I initialized the emiter by</p>
  
  <pre class="lang-swift prettyprint-override"><code>private let eventEmitter: MyEventEmitter = .shared
  
  // send event
  self.eventEmitter.sendEvent(withName: "someEvent", body: nil)
  </code></pre>
  
  <p>I also put <code>&lt;React/RCTBridgeModule.h&gt;</code> and <code>&lt;React/RCTEventEmitter.h&gt;</code> inside my bridging header. </p>
  
  <p>What did I do wrong here?</p>