How to bridge a Swift Promise to React Native
Found the answer, Just had to add @escaping to the arguments:
@objc func fling(_ options: NSDictionary, resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
...
ReactNative native-modules Promise passing field and in Swift
I was able to figure out how to get resolve the problem. Here is the solution for anyone who might need
GuidedTourInterfaceBridge.m
RCT_EXTERN_METHOD(readFile:(NSArray *)arr resolve:(RCTPromiseResolveBlock *)resolve reject:(RCTPromiseRejectBlock *)reject)
GuidedTourInterface.swift:
func readFile(_ arr: NSArray, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void {
JS File:
var result = await guidedTourInterface.readFile([this.props.mapToShow+"/info.json"])
.then((result) => {
Related Topics
Pdf417 Decode and Generate The Same Barcode Using Swift
Heightanchor.Constraint Not Change Height of View
Why Are Image Views Sometimes Not Appearing in Collection View Cells
Avoid Equatable and Hashable Boilerplate, Swift 4.2
How to Get Section of UItableview from Inside a Child UIcollectionview
In Swift Can You Trap "Fatal Error Unexpectedly Found Nil While Unwrapping an Optional Value"
Decrypting Des with Commoncrypto in Swift 3
Uicollectionview Selected Cells Issue
iOS Application Support Directory Exists on Devices by Default
Loading Many UIimages from Disk Blocks Main Thread
Changing Associated Value of Enum Swift
Programmatically Select All Cells in Tableview So Next Time They Are Pressed They Call Diddeselect
Validate Unicode Code Point in Swift
How to Run Terminal Command in Swift from Any Directory
Macos Remote Push Notifications Not Showing Alert Banner