跳转到内容

NativeScript

维基百科,自由的百科全书

这是本页的一个历史版本,由SunAfterRain留言 | 贡献2022年7月12日 (二) 09:48 (Copy From en:NativeScript version 1097690408编辑。这可能和当前版本存在着巨大的差异。

(差异) ←上一修订 | 最后版本 (差异) | 下一修订→ (差异)
NativeScript
原作者Telerik by Progress.[1]
開發者Community
首次发布2014年 (2014)
当前版本8.2.2(2022年4月6日,​3年前​(2022-04-06[2]
源代码库 編輯維基數據鏈接
编程语言JavaScript, TypeScript
平台Cross-platform
许可协议Apache License 2.0
网站nativescript.org

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] 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]

Development

NativeScript 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][17]

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.[18] 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.[19] 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.[20] 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 [21] or com.android.widget.Button on Android.[22]

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 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.[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][23]

Angular integration

With the launch of NativeScript 2.0, it is possible to use Angular to build cross-platform mobile applications.[24] Additionally, when using Angular with NativeScript you have the ability to share large chunks of code between your web and mobile apps.[25]

Vue.js integration

The Vue.js framework is supported in NativeScript via the nativescript-vue plugin.[7]

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

  1. ^ 1.0 1.1 Frequently asked questions about NativeScript. NativeScript.org. [2016-03-20]. (原始内容存档于2016-03-18). 
  2. ^ Releases · NativeScript/NativeScript. GitHub. [2018-06-03]. (原始内容存档于2021-08-31). 
  3. ^ Creating Mobile Native Apps in JavaScript with NativeScript. InfoQ. [2022-07-12]. (原始内容存档于2022-06-19). 
  4. ^ Saripella, Surya. The Next Chapter for NativeScript: nStudio. NativeScript. [2022-07-12]. (原始内容存档于2021-01-16). 
  5. ^ Romoff, Rachel. NativeScript joins OpenJS Foundation as Incubating Project. The Linux Foundation Projects. OpenJS Foundation. 7 December 2020 [4 March 2021]. (原始内容存档于25 January 2021). 
  6. ^ 6.0 6.1 6.2 Krill, Paul. JavaScript goes native for iOS, Android, and Windows Phone apps. InfoWorld. March 10, 2015 [July 12, 2022]. (原始内容存档于January 3, 2022). 
  7. ^ 7.0 7.1 NativeScript-Vue. nativescript-vue.org. [2017-10-31]. 
  8. ^ NativeScript framework eases cross-platform app development woes. searchcloudcomputing.techtarget.com. [2021-08-06]. (原始内容存档于2021-08-06). 
  9. ^ Krill, Paul. NativeScript warms up to AngularJS for mobile dev. InfoWorld. May 6, 2016 [July 12, 2022]. (原始内容存档于June 12, 2022). 
  10. ^ SD Times GitHub Project of the Week: NativeScript. March 18, 2016 [July 12, 2022]. (原始内容存档于March 27, 2022). 
  11. ^ 11.0 11.1 11.2 Telerik's NativeScript Aims To Centralize Cross-Platform Mobile Development -. Visual Studio Magazine. [2016-11-21]. (原始内容存档于2017-11-07). 
  12. ^ NativeScript 1.0.0 Released. www.i-programmer.info. [2022-07-12]. (原始内容存档于2022-06-11). 
  13. ^ NativeScript 1.0.0 is now available. NativeScript.org. [2016-11-04]. (原始内容存档于2016-10-05). 
  14. ^ NativeScript Marketplace. market.nativescript.org. [2018-03-14]. (原始内容存档于2018-03-15). 
  15. ^ nativescript - npm search. www.npmjs.com. [2016-11-21]. (原始内容存档于2017-02-11). 
  16. ^ Review, C. I. O. Progress Releases NativeScript 2.0 with Cross-Platform Deployment Capabilities. CIOReview. [2022-07-12]. (原始内容存档于2022-06-21). 
  17. ^ Getting to Know Angular 2. mobile.htmlgoodies.com. 15 November 2016 [12 July 2022]. (原始内容存档于27 September 2019). 
  18. ^ NativeScript Sidekick - your faithful companion for app development. NativeScript.org. [2017-10-31]. (原始内容存档于2017-11-07) (英语). 
  19. ^ Hanna, Tam. Mit JavaScript wie hausgemacht: NativeScript. Developer. [2022-07-12]. (原始内容存档于2021-07-25). 
  20. ^ The Basics - NativeScript Docs. docs.nativescript.org. [2016-11-21]. (原始内容存档于2016-11-21). 
  21. ^ NativeScript/NativeScript. github.com. [2022-06-20]. (原始内容存档于2022-06-20). 
  22. ^ NativeScript/NativeScript. github.com. [2022-06-20]. (原始内容存档于2022-06-20). 
  23. ^ Accessing Native APIs through JavaScript - NativeScript Docs. docs.nativescript.org. [2016-11-21]. (原始内容存档于2016-11-24). 
  24. ^ NativeScript 2.0 - the best way to build cross-platform native mobile apps. NativeScript.org. [2016-11-21]. (原始内容存档于2016-12-20). 
  25. ^ Witalec, Sebastian. Apps That Work Natively on the Web and Mobile. Medium. 2018-08-24 [2021-08-06]. (原始内容存档于2022-01-03) (英语). 

Template:Rich web applicationsFor React-Native App Development Services