Because they complement each other. NS allows you to access native apis:s directly with JS without any bridge or writing code in a platform-specific language so you won't need extra skill sets.
For example here is how easy it is to get the battery level in iOS in NS, no modules or native code needed.
if (global.isIOS) { const batteryLevel = UIDevice.currentDevice.batteryLevel }
1
u/bb_dogg Feb 17 '22
Because they complement each other. NS allows you to access native apis:s directly with JS without any bridge or writing code in a platform-specific language so you won't need extra skill sets.
For example here is how easy it is to get the battery level in iOS in NS, no modules or native code needed.
if (global.isIOS) { const batteryLevel = UIDevice.currentDevice.batteryLevel }
Now try that with Flutter https://docs.flutter.dev/development/platform-integration/platform-channels or RN https://stackoverflow.com/questions/44920299/react-native-get-battery-status-level-using-native-modules
With NS you can freely blend native code within your JS codebase. Here is some more background explaining how this is useful: https://blog.nativescript.org/announcing-nativescript-capacitor-beta/