Skip to content

Instantly share code, notes, and snippets.

View mouselangelo's full-sized avatar

Chetan Agarwal mouselangelo

  • flowkey
  • Berlin, Germany
View GitHub Profile
@harveyconnor
harveyconnor / README.md
Created May 26, 2020 01:13
React Native Swift Module Singleton Pattern with Events Example

React Native Swift Module Singleton Pattern

If you are reading this tutorial please be aware that this is for advanced users that require a singleton pattern in their RN native module and some documentation detail is left out intentionally.

For the sake of this tutorial we will be using TestManager as our class.

Instructions

  1. First of all you need to setup a swift class with a bridging header, in Xcode it will generate this for you upon creating a Swift file.
  2. Create your swift class with the @objc directive.
  3. Create a second class that has a static export of the class in singleton.
  4. Follow the files below for a boilerplat example.