Part 3: Cross-Platform Mobile App Frameworks – NativeScript

In Part 2 of this article series, we explored the Xamarin mobile app framework as well as its advantages and disadvantages. Now, in Part 3, we will conduct a deep dive into an alternative mobile app framework: NativeScript.

NativeScript is an opensource framework for building native mobile apps using Angular, JavaScript, or TypeScript. It is supported by Progress and offers a great option to build mobile apps using your knowledge of web development. Like Xamarin, you have the option to create truly native apps for iOS and Android because it allows direct access and use of native components and device API.

Advantages

  • Uses Angular, and TypeScript or JavaScript
    • Access to Angular data binding, dependency injection, reusable components
    • TypeScript is a strongly typed, object-oriented language
  • Uses NativeScript Command Line Interface(CLI)
  • Uses Visual Studio Code
    • Lightweight but with a lot of similarities as Visual Studios
  • Use native components and has access to native device API
  • Uses XML based markup language similar HTML
  • CSS style styling
  • Uses Node Package Manager for plugin Support
  • Large assortment of opensource plugins
  • Live syncing of code changes during development

Developing on NativeScript is great because it allows you to use your web development skills to create a cross-platform native app. You can use Angular and gain access to powerful features such as data binding in the UI, dependency injection for the service architecture, and building reusable components which can be shared across multiple apps.

NativeScript uses an XML based markup language which closely resembles and functions like HTML to create the screens and UI. It also uses a small subset of CSS to style the screens. It comes with some standard views which are wrapped around the corresponding native component, and gain access to native API to interact with the component. Again, Button is actually rendering an android.widget.Button and UIButton but you use what looks and feels like HTML to create your interface instead.

 

Navigation.html

 

The NativeScript views offer a common API which can interact with the native components and style them in the form of CSS. However, you don’t get access to all the selectors and properties offered in CSS. What you get is the ability style and access native components and properties in a way like how you would on a webpage.

Navigation.css

 

Logic is written in TypeScript; however, it can also be written in JavaScript if that is your preference. With TypeScript, you get a language that is strongly-typed and object-oriented and compiles to JavaScript. Using TypeScript also makes Visual Studio Code the favored IDE since it offers TypeScript support; however, the NativeScript CLI should allow development on an IDE of your choice.

Navigation.component.ts

 

Again, what you get is an app that looks and performs a lot like a native app but that is written in TypeScript or JavaScript, and using web familiarity.

NativeScript App Navigation page

 

NativeScript currently has a fair amount of opensource plugins available for different features you may want to leverage, such as media or music player plugins, multiple upload functionality, and even face recognition plugins. The list is fairly comprehensive and growing; however, if you can’t find a suitable plugin on the list, you have the option to create one as well. You can access the list of NativeScript plugins at: https://market.nativescript.org/

Disadvantages

  • NativeScript apps are larger than native apps
  • Some buggy opensource plugins

Some of the disadvantages with NativeScript include having a larger app size than native. When building the APK/IPA, you should run WebPack and Uglify to reduce the size of the application.

To build for the iOS side, you will also need a Mac running macOS. Again, you will also need to set up a developer account and get a paid developer license to register your Apple devices so that the app can be tested on them.

Opensource plugin support is nice, and there are a lot of options from which to choose in order to add functionality to your app, but we have encountered some bugs with some plugins that required some fixing or exclusion from the app.

Coming Up Next

Next, in Part 4 of this Cross-Platform Mobile App Framework article series, we will bring it all together and look at which platform will be the best to choose for you and your team.

 

Read Part 4

 =====

Imaginet is your trusted technology partner who turns your business innovation ideas into reality. 20+ years | 1200+ satisfied customers | 2500+ successful engagements. Specialties include Web Application Development, Mobile App Development, SharePoint services, and more. Located in Dallas (Irving), Winnipeg, Phoenix, St. Louis, and Calgary with services offered worldwide. Contact us today at info@imaginet.com or 1-800-989-6022.

Chue Yee Xiong

About Chue Yee Xiong

Chue Yee Xiong is a Software Developer for Imaginet with experience in mobile and web development using Xamarin, NativeScript, and .NET frameworks. He has a passion for constantly learning new things and has worked on the design and development of mobile and web applications for use in the financial and government industries.

Let‘s Talk.
  • Let's Talk

  • This field is for validation purposes and should be left unchanged.