ReactNative Native Modules in Swift – Part 3 (details, conclusion, …)

To give a conclusion to this subject treated in Part1 and Part2, I want to go back to how native module work and how to communicate between native modules and ReactNative modules.

First, let’s talk about the .m file that enables to link native to JS thru runtime. The code was this :

#import <React/RCTBridgeModule.h>

@interface RCT_EXTERN_MODULE(MyNativeModule, NSObject)
RCT_EXTERN_METHOD(triggerJSRequest)
@end

Continue reading “ReactNative Native Modules in Swift – Part 3 (details, conclusion, …)”

ReactNative Native Modules in Swift – Part 2 (ReactNative bridging)

In Part 1, we saw how to integrate ReactNative inside a Swift project using Cocoapods. Now, before starting to create a ReactNative View and integrate it into our project.

First, let’s take a quick tour of how ReactNative works.

I will not dive in depth (first because I don’t have enough expertise so far and second because it could take a complete book to make it) but at least I will reveal a little bit of the magic behind ReactNative from what I understood and read. There’s a very nice talk from Peggy Rayzis about this subject that you can watch here.

Continue reading “ReactNative Native Modules in Swift – Part 2 (ReactNative bridging)”

ReactNative Native Modules in Swift – Part 1 (Install ReactNative inside a Swift project…)

So I was working on a clean architecture example in Swift based on this post and the way I implement VIPR. I was adding/implementing a simplified version of it based on the graph represented in Fig-1.

Fig – 1 : VIPR Simplified in Swift

And then I decided to prove that this architecture is really decoupled and thus wanted to integrate a ReactNative View into it. Of course I was overestimated my knowledge of ReactNative because I did few small projects in ReactNative and it looked very easy (because I was not bridging to native modules…). Continue reading “ReactNative Native Modules in Swift – Part 1 (Install ReactNative inside a Swift project…)”