NativeScript

NativeScript is an open-source framework to develop apps on the Apple iOS and Android platforms. It was originally conceived and developed by Progress.[2] NativeScript apps are built using platform agnostic programming languages such as JavaScript or TypeScript. NativeScript directly supports the AngularJS framework.[3] Mobile applications built with NativeScript result in fully native Apps, which use the same APIs as if they were developed in Xcode or Android Studio.[4] Additionally software developers can repurpose third-party libraries from Cocoapods, Android Arsenal, Maven and npm.js in their mobile applications without the need for wrappers.[5][6][7]

Development

NativeScript was publicly released first in March 2015. Version 1.0.0 followed two months later.[8] The framework quickly gained popularity reaching 3000 github-stars and over 1500 followers on twitter soon after the public release.[9] In the meantime, over 450 plugins are available, which are either officially supported by Telerik or stem from the open source community.[10][11] The current version, 2.5, contains support for Webpack 2.0, Chrome Developer Tools and many enhancements to improve the developer experience.[12] The use of Angular is an optional development approach allowing for application source code to be shared between the web platform and mobile platform.[13][14]

Structure

NativeScript and all the required plugins are installed using the package manager npm. Projects are created, configured and compiled via the command line. Platform independent user interfaces are defined using XML files. NativeScript then uses the abstractions described in the XML files to call native elements of each platform. Application logic developed in Angular2 and TypeScript can be developed independent of the target platform as well. A NativeScript mobile application is built using the node.js runtime and tooling.[15] Telerik aims for a ratio of 90% common code between the iOS and Android platforms.[16]

Direct access to native platform APIs and Controls

Platform independent user interfaces are defined using XML files.[17] NativeScript uses the XML data structures representing the cross platform abstraction to trigger platform specific code that directly interacts with the native elements of the deploy target operating system. This means a call to a NativeScript provides UI abstraction for Button, will directly call UIButton on iOS [18] or com.android.widget.Button on Android.[19] Application logic developed in Angular2 and TypeScript can be developed independent of the target platform as well. A NativeScript app is built using the node.js runtime and tooling.[15] Telerik aims for a ratio of 90% common code between the platforms [16]

While application source code is written in JavaScript, TypeScript or Angular, the source code is not compiled or otherwise mutated. The source code as is runs directly on the device. This architectural choice eliminates the need for cross-compiling or transpiling.[7] Additionally, while the application source code is written in languages commonly encountered in a browser, or in a WebView contained mobile application, NativeScript applications run directly on the native device. There is no DOM manipulation or any mandatory browser interaction.[3]

Notable features

Native API Reflection (A.K.A 0-Day Access)

Another notable feature is the use of reflection to handle native API end points. Rather than require separate binding layers between NativeScript and each mobile platform API, NativeScript uses reflection to gain information and metadata about the native platform APIs. New features added to any native platform API are available immediately.[3]

Another way the reflection feature is used is in working with 3rd party libraries. As JavaScript (or TypeScript/Angular) can talk directly to native code, there is no need to write binding layers in Objective-C, Swift or Java.[7][20]

Angular 2 integration

With the launch of NativeScript 2.0, it is now possible to use Angular 2 to build cross-platform mobile applications [21]

References

  1. ^ https://www.nativescript.org/faq
  2. ^ https://www.infoq.com/news/2015/03/nativescript
  3. ^ a b c http://www.infoworld.com/article/2893706/mobile-development/javascript-native-ios-android-and-windows-phone-apps.html
  4. ^ http://searchcloudapplications.techtarget.com/podcast/NativeScript-framework-eases-cross-platform-app-development-woes
  5. ^ http://www.infoworld.com/article/3066900/javascript/nativescript-warms-up-to-angularjs-for-mobile-dev.html
  6. ^ http://sdtimes.com/sd-times-github-project-of-the-week-nativescript/
  7. ^ a b c https://visualstudiomagazine.com/articles/2015/03/09/telerik-nativescript-beta-mobile.aspx
  8. ^ http://www.i-programmer.info/news/167-javascript/8561-nativescript-100-released.html
  9. ^ https://www.nativescript.org/blog/nativescript-1.0.0-is-now-available
  10. ^ http://nativescript.rocks/all.php
  11. ^ https://www.npmjs.com/search?q=nativescript
  12. ^ https://www.nativescript.org/blog/nativescript-25-is-now-available
  13. ^ http://www.cioreview.com/news/progress-releases-nativescript-20-with-crossplatform-deployment-capabilities-nid-14646-cid-19.html
  14. ^ http://www.htmlgoodies.com/beyond/javascript/getting-to-know-angular-2.html
  15. ^ a b http://www.heise.de/developer/artikel/Mit-JavaScript-wie-hausgemacht-NativeScript-3282619.html
  16. ^ a b http://www.telerik.com/platform/nativescript/faq
  17. ^ https://docs.nativescript.org/ui/basics
  18. ^ https://github.com/NativeScript/NativeScript/blob/master/tns-core-modules/ui/button/button.ios.ts
  19. ^ https://github.com/NativeScript/NativeScript/blob/master/tns-core-modules/ui/button/button.android.ts
  20. ^ https://docs.nativescript.org/core-concepts/accessing-native-apis-with-javascript
  21. ^ https://www.nativescript.org/blog/nativescript-2.0---the-best-way-to-build-cross-platform-native-mobile-apps

External links