I am integrating an iOS framework (Vidyo https://developer.vidyo.io/#/documentation/4.1.25.30) from a custom NativeScript plugin. I am able to instantiate iOS class from my plugin but I am not able to call properly this iOS function :
(id) init:(void*)view RemoteParticipants:(unsigned int)remoteParticipants LogFileFilter:(const char*)logFileFilter LogFileName:(const char*)logFileName
From the nativescript command
TNS_DEBUG_METADATA_PATH="$(pwd)/metadata" tns build ios
I am able to see the signature that NativeScript is waiting for :
- Name: 'init:ViewStyle:RemoteParticipants:LogFileFilter:LogFileName:'
JsName: initViewStyleRemoteParticipantsLogFileFilterLogFileName
Filename: [...].h
Module:
[...]
Type: Method
Signature:
- Type: Instancetype
- Type: Pointer
PointerType:
Type: Void
- Type: Enum
Name: VCConnectorViewStyle
- Type: UInt
- Type: CString
- Type: CString
When I give a void pointer it's working, however the function is waiting for a view to display a video so the function is doing its job but I see nothing on my iOS app. For now I have my UIView :
this.nativeView = UIView.alloc().initWithFrame(UIScreen.mainScreen.bounds)
initViewStyleRemoteParticipantsLogFileFilterLogFileName(this.nativeView, [...])
It does not works, as I have an error :
ERROR Error: Value is not a pointer.
Question : How to get a pointer from my UIView ?
Finally found the solution, with some luck to be honest :
this.nativeView = UIView.alloc().initWithFrame(UIScreen.mainScreen.bounds)
let ref = new interop.Reference(interop.Pointer, this.nativeView)
initViewStyleRemoteParticipantsLogFileFilterLogFileName(ref, [...])
Quite straightforward but the documentation was not clear about it. Hope this helps