javascript – Easy methods to name a Swift perform in a .js file in VSCode

[ad_1]

I’m presently programming an app which makes use of the Digicam (RAW picture format) on MacOS.
Subsequently I used react-native to create the app utilizing the .js information. Due to the RAW picture format, I’ve/need to use my very own features from SWIFT.

Is there a risk to make use of the SWIFT features inside my .js information with out a Goal-C bridge inbetween? My present strategy beneath:

swift file:

import AVFoundation
import Basis

@objc protocol MyJSClass : JSExport {
     func myfunc()
}

class MyClass: NSObject, MyJSClass{
     func myfunc(){
     }
}

and in my .js file:

...
import {NativeModules} from 'react-native';
...
export default MyScreen = {{ route, navigation }} => {
     const module = NativeModules.MyJSClass
     module.myfunc();
...
};
...

the error I obtain is

null just isn’t an object (evaluating ‘module.take a look at’)

I debug utilizing expo run:ios

[ad_2]

Leave a Reply