|
|
|
|
|
by ramesh31
1273 days ago
|
|
> But your react logic is still executing as JavaScript. Yes, but this is no different than how native works. On iOS, The JS Bridge compiles to bytecode and talks to the Obj-C runtime for native needs like Cocoa, just as Swift does. Sure you could get better performance by writing your apps directly in Obj-C, but I don't think many people want to go back to those days. |
|
Some definitions:
- The Obj-C runtime is just a shared library that Swift links to on compilation (/usr/lib/libobjc.A.dylib). The performance to call into it is identical for Swift and Obj-C.
- "Sure you could get better performance by writing your apps directly in Obj-C..." Swift code is native code. Cost to access the runtime is identical.
- There is one "hop" to go from Swift to the Obj-C runtime.
- There are >2 "hops" to go through the JS Bridge. https://hackernoon.com/understanding-react-native-bridge-con...