NativeScript
NativeScript provides platform APIs directly to the JavaScript runtime (with strong types) for a rich TypeScript development experience. As an open-source framework to develop apps for iOS, visionOS and Android platforms combining a best of all worlds approach marrying familiar Web approaches like CSS and view templating with common platform languages (Swift, Kotlin, Objective-C, Java) it delivers a liberating toolset for developers. It was originally conceived and developed by Bulgarian company Telerik, later acquired by Progress Software.[3] At the end of 2019[4] responsibility for the NativeScript project was taken over by long-time Progress partner, nStudio. In December 2020, nStudio also oversaw the induction of NativeScript into OpenJS Foundation as an Incubating Project.[5] NativeScript apps are built using JavaScript, or by using any programming language that transpiles to JavaScript, such as TypeScript. NativeScript supports the Angular[6] and Vue JavaScript frameworks.[7] 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.[8] Additionally, software developers can re-purpose third-party libraries from CocoaPods, Maven, and npm.js in their mobile applications without the need for wrappers.[9][10][11] DevelopmentNativeScript was publicly released first in March 2015. Version 1.0.0 followed two months later.[12] The framework quickly gained popularity reaching 3000 github-stars and over 1500 followers on Twitter soon after the public release.[13] In the meantime, over 700 plugins are available, which are either officially supported by Progress or stem from the open source community.[14][15] The use of Angular is an optional development approach allowing for application source code to be shared between the web platform and mobile platform.[16] StructureNativeScript 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.[17] 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.[18] Progress aims for a ratio of 90% common code between the iOS and Android platforms.[1] Direct access to native platform APIs and controlsPlatform-independent user interfaces are defined using XML files.[19] 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[20] or com.android.widget.Button on Android.[21] 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.[11] 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.[6] Notable featuresNative API reflectionAnother 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.[6] 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.[11][22] Angular integrationWith the launch of NativeScript 2.0, it is possible to use Angular to build cross-platform mobile applications.[23] Additionally, when using Angular with NativeScript you have the ability to share large chunks of code between your web and mobile apps.[24] Vue.js integrationThe Vue.js framework is supported in NativeScript via the nativescript-vue plugin.[7] Supporting tools and services
References
External links |