1.1.0 • Published 4 months ago

kovalee-react-native-sdk v1.1.0

Weekly downloads
-
License
-
Repository
github
Last release
4 months ago

Kovalee React Native SDK

Wrapper around the KovaleeSDK for iOS

Installation

npm install kovalee-react-native-sdk

How to make changes to the RN SDK

iOS side

Let's say you want to add a function called multiply(a, b) to the SDK

  1. Open ios/KovaleeRnSdk.xcodeproj with XCode
  2. In KovaleeRnSdk.swift, add the logic of the function:
@objc(multiply:withB:withResolver:withRejecter:)
  func multiply(a: Float, b: Float, resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) -> Void {
	  resolve(a*b)
  }
  1. In KovaleeRnSdk.mm, export the method so it is available in React Native:
RCT_EXTERN_METHOD(multiply:(float)a withB:(float)b
                 withResolver:(RCTPromiseResolveBlock)resolve
                 withRejecter:(RCTPromiseRejectBlock)reject)

React Native side

  1. In /src/index.tsx, define the new method we just add in the XCode project:
export function multiply(a: number, b: number): Promise<number> {
  return KovaleeRnSdk.multiply(a, b);
}

You're done! 🎉

How to test the RN SDK

Let's say we want to test the method multiply(a, b) we created above

  1. Open example/ios/KovaleeRnSdkExample.xcworkspace with XCode
  2. Make sure you ran yarn install and pod install in the ios/ folder
  3. In example/src/App.tsx:
    import { multiply } from 'kovalee-rn-sdk';
    // call multiply() wherever you want in the code
  4. Run yarn start in a terminal
  5. Build the app either in XCode or by running yarn ios in a terminal

You're done! 🎉

How to release a new version

  1. Make sure you pull master and that you are up to date
  2. Increment the version of the package in package.json
  3. Commit the change on GitHub with the following commit message: chore: release vx.x.x
  4. Run npm publish in your terminal at the root of the project
  5. The credentials to login to npm and the OTP are in 1Password
1.1.0

4 months ago

1.0.0

6 months ago

0.1.5

6 months ago

0.1.4

7 months ago

0.1.3

7 months ago

0.1.2

7 months ago

0.1.1

8 months ago

0.1.0

8 months ago