How to bridge React Native Promise to Swift

后端 未结 3 1417
慢半拍i
慢半拍i 2021-02-12 14:46

Hi fellow software enthousiasts,

I am currently working on a React native project for which I need to add some logic which has been written in swift. I am able to trigge

3条回答
  •  一生所求
    2021-02-12 15:11

    Adding so that the complete solution is shown

    .m - note that the resolve parameter is not "named"

    RCT_EXTERN_METHOD(loginWithEmail: (RCTPromiseResolveBlock)resolve
                                      rejecter:(RCTPromiseRejectBlock)reject)
    

    .swift - same as @Koen

    @objc func loginWithEmail(_ resolve: @escaping RCTPromiseResolveBlock,
                                rejecter reject: @escaping RCTPromiseRejectBlock ) -> Void {}
    

提交回复
热议问题