NativeScript
NativeScript is an open-source framework to develop mobile apps on the Apple iOS and Android platforms. It was originally conceived and developed by Progress.[3] NativeScript apps are built using JavaScript, or by using any programming language that transpiles to JavaScript, such as TypeScript. NativeScript supports the Angular[4] and Vue JavaScript frameworks.[5] 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.[6] Additionally, software developers can re-purpose third-party libraries from CocoaPods, Maven, and npm.js in their mobile applications without the need for wrappers.[7][8][9]
Original author(s) | Telerik by Progress.[1] |
---|---|
Developer(s) | Progress and community |
Initial release | 2014 |
Stable release | 7.0.13
/ October 28, 2020[2] |
Repository | |
Written in | JavaScript, TypeScript |
Platform | Cross-platform |
License | Apache License 2.0 |
Website | www |
Development
NativeScript was publicly released first in March 2015. Version 1.0.0 followed two months later.[10] The framework quickly gained popularity reaching 3000 github-stars and over 1500 followers on Twitter soon after the public release.[11] In the meantime, over 700 plugins are available, which are either officially supported by Progress or stem from the open source community.[12][13] The use of Angular is an optional development approach allowing for application source code to be shared between the web platform and mobile platform.[14][15]
Structure
NativeScript and all the required plugins are installed using the package manager npm. Projects are created, configured, and compiled via the command line or a GUI tool called NativeScript Sidekick.[16] Platform-independent user interfaces are defined using XML files. NativeScript then uses the abstractions described in the XML files to call native UI elements of each platform. Application logic developed in Angular 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.[17] Progress aims for a ratio of 90% common code between the iOS and Android platforms.[1]
Direct Access to Native Platform APIs and Controls
Platform-independent user interfaces are defined using XML files.[18] 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 target operating system. This means a call to the NativeScript Button API provides a UI abstraction for Button, which directly calls UIButton on iOS [19] or com.android.widget.Button on Android.[20]
While application source code is written in JavaScript, TypeScript, Angular, or Vue.js, 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.[9] 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.[4]
Notable Features
Native API Reflection
Another notable feature is the use of reflection to handle native API endpoints. Rather than requiring 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.[4]
Another way the reflection feature is used is in working with third 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, Java or Kotlin.[9][21]
Angular Integration
With the launch of NativeScript 2.0, it is possible to use Angular to build cross-platform mobile applications.[22] Additionally, when using Angular with NativeScript you have the ability to share large chunks of code between your web and mobile apps.[23]
Vue.js Integration
The Vue.js framework is supported in NativeScript via the nativescript-vue plugin.[5]
Supporting tools and services
- NativeScript Sidekick is a graphical user interface that builds off of the capabilities provided by the NativeScript CLI. With Sidekick a developer can leverage app templates, cloud-based builds for iOS and Android, and publish apps to the public app stores.
- NativeScript Playground allows developers to experiment with NativeScript in a web-based environment, and preview apps on physical devices.
- NativeScript Marketplace is a curated source of NativeScript plugins, pre-built app templates, and runnable sample apps.
References
- "Frequently asked questions about NativeScript". NativeScript.org.
- "Releases · NativeScript/NativeScript". GitHub.
- "Creating Mobile Native Apps in JavaScript with NativeScript". InfoQ.
- Krill, Paul (March 10, 2015). "JavaScript goes native for iOS, Android, and Windows Phone apps". InfoWorld.
- "{N}-Vue". nativescript-vue.org. Retrieved 2017-10-31.
- http://searchcloudapplications.techtarget.com/podcast/NativeScript-framework-eases-cross-platform-app-development-woes
- Krill, Paul (May 6, 2016). "NativeScript warms up to AngularJS for mobile dev". InfoWorld.
- "SD Times GitHub Project of the Week: NativeScript". March 18, 2016.
- "Telerik's NativeScript Aims To Centralize Cross-Platform Mobile Development -". Visual Studio Magazine.
- "NativeScript 1.0.0 Released". www.i-programmer.info.
- "NativeScript 1.0.0 is now available". NativeScript.org.
- "NativeScript Marketplace". market.nativescript.org.
- "nativescript - npm search". www.npmjs.com.
- Review, C. I. O. "Progress Releases NativeScript 2.0 with Cross-Platform Deployment Capabilities". CIOReview.
- "Getting to Know Angular 2". mobile.htmlgoodies.com.
- "NativeScript Sidekick - your faithful companion for app development". NativeScript.org. Retrieved 2017-10-31.
- Hanna, Tam. "Mit JavaScript wie hausgemacht: NativeScript". Developer.
- "The Basics - NativeScript Docs". docs.nativescript.org.
- https://github.com/NativeScript/NativeScript/blob/master/tns-core-modules/ui/button/button.ios.ts
- https://github.com/NativeScript/NativeScript/blob/master/tns-core-modules/ui/button/button.android.ts
- "Accessing Native APIs through JavaScript - NativeScript Docs". docs.nativescript.org.
- "NativeScript 2.0 - the best way to build cross-platform native mobile apps". NativeScript.org.
- https://blog.angular.io/apps-that-work-natively-on-the-web-and-mobile-9b26852495e7