NativeScript enables developers to build native apps for iOS and Android while sharing the application code across the platforms. When building the application UI, developers use our libraries, which abstract the differences between the native platforms.
This article is not my first rodeo with NativeScript; I already played with it half a year ago. Unfortunately, while initial installation was a piece of cake, upgrading it was a significantly more complicated task.
To be honest, only a smaller part of it was thanks to NativeScript. I’m using virtual machines for my different development platforms, and this particular one was not upgraded since April. Most of my problems were related to npm which was too old to be usable.
// Install NativeScript npm install -g nativescript //Create Your First Project tns create MyProject // Deploy project on device… tns run android tns run ios //...or deploy project in emulator tns run android --emulator tns run ios --emulator
Look and Feel
My first introduction to NativeScript was not a pleasant experience. When it was first introduced, it was very hard to style your application correctly. It simply lacked more advanced styling options. UI felt amateurish at best; it simply wasn’t production ready.
In the wake of investing hours getting NativeScript upgraded, I set out to build my first real NativeScript application. Each time I learn a new framework I like to create the same type of application, one that retrieves data from the open online movie database. Up to this point, I had the most fun combining OnsenUI and AngularJS to produce precisely this kind of application.
The first thing I discovered was how essentially it was hard to style my application, mostly a listview. While working with Ionic Framework or OnsenUI, you have a prebuilt great looking listview directive. If you don’t like it, you can always style it with some additional CSS. Unfortunately, this did not go as smoothly with NativeScript. No matter how much time I spent modifying widget XML, I couldn’t make it look anything like what I needed.
Making a list, was straightforward, styling it was a horror story.
Don’t get me wrong, this situation is not that bad, it was expected. I had the same experience with Titanium and Xamarin (I’m still learning React Native so I’m not going to include it in this list). It just takes some time before you can master it (them).
On the other hand, compared to standard hybrid frameworks like Ionic Framework or God forbid jQuery Mobile, NativeScript listviews offer a fluid scrolling, not to mention native page/view animations.
Plugins and Services
When I talk about plugins, I’m talking about components not initially included with vanilla NativeScript. If the framework does not expose an API you need, you can create a plugin that exposes the required functionality. When you develop a plugin.
This is an excellent feature, especially because NativeScript is an open source framework and we can expect a larger community. This kind of community will, in time, provide us with 3rd party plugins and components. Something similar in fashion to currently available React Native.
I should also mention that initial framework version had a limited set of available components and plugins, but this list has grown in a past few months. Hopefully, it will continue growing.
Now let us talk about provided tools and services. Before you create your first application, you need to decide how are you going to develop it. You can do it in your own environment using NativeScript Command-Line Interface (NativeScript CLI) or you can do it in a provided cloud environment using Telerik AppBuilder. By default, I will always choose a CLI approach but if some platform (like Apple Mac) is not available to you, you can always use cloud environment. You are not forced to pick sides, just choose one that best suits your current needs.
When working with CLI, you can use any IDE you prefer, you’re not limited in any way (I prefer Sublime). Telerik AppBuilder offers a different approach. You can use it directly from your web browser, via Windows client software, or ever via Visual Studio.
Last but not least. You probably guessed this from the rest of my article, but NativeScript is available on all major platforms, including Windows, Linux, and MacOS. This information may not seem that important until you take into account that React Native (probably the biggest NativeScript rival) is available mainly on MacOS. Since last few weeks, it’s also available on Linux.
Everything summarized here is also described in the article so I won’t go into great details.
- Write once and run on three platforms
- Open source + growing community
- Available on all major platforms (Windows, Linux, MacOS)
- Native UI components, UX, and performance
- Hot Reload for fast development
- Angular 2.0 and TypeScript support
- Single code base
- Cross-platform UI abstractions
- Cross-platform UI abstractions – Yes this is also a major weakness
- Still lacking some UI components and options
- Needs more time to grow a decent 3rd party community, current number of available components is limited
- It’s to early to tell if this approach is going to work
In a nutshell, NativeScript allows you to write once and run on three platforms. Can it do it? Technically yes, but only time will tell if this is ever going to run smoothly and without problems. This kind of approach is a Holy Grail of mobile development, and other similar frameworks never managed to do it properly. This one may stand a chance because of its open source nature.
Personally, I’m still unsure regarding NativeScript. I like it, but I’m aware it still requires some time to grow on its own. On the one hand, this framework is perfect for non-complex applications. Those applications that require only existing platform UI components. On the other hand, most major mobile applications are full of not publicly available custom components, so if you want to do something exceptional prepare to do some native Java/Objective C coding.
Finally the most important point, I’m predicting a great future for NativeScript. Thus, I’ll continue writing and covering everything about it. Keep a good work.