My NativeScript Experience

When Modulus needed its app rewritten, it was a perfect opportunity for me to explore NativeScript to rewrite the app. In this article I’ll share some of my experiences using NativeScript to build this app.

ModulusDemo

Why did I choose NativeScript?

  1. I needed to write both and iOS as well as an Android version of the app.
  2. I’ve invested a good amount of time writing Node.js apps, so the transition was very smooth.  I also was able to take advantage of many npm modules.
  3. NativeScript was created by Telerik, which is part of the Progress family (of which Modulus is also a part).

Getting Started

Before I start writing about my experiences, I wanted to list out some some technical details of the app so you know of what I was working with.

  • NativeScript v1.3
  • NativeScript Telerik UI v0.1.0
  • tns-ios v1.4.1
  • Xcode v 7.1.1
  • OSX Yosemite
  • Sublime IDE w/ NativeScript CLI

I started learning NativeScript by going through the tutorials at NativeScript.org. I quickly learned how to get up and running.  The next thing I did was learn how to find and install plugins and write custom controls.  After playing around with sample apps and some custom code, I was ready to hit the ground running.  What follows is a summary of some of my experiences.

Experiences

If time is of essence, prioritize which app is more important

At first, I started writing the app for both Android and iOS.  I would test all my changes on both platforms, and spend time fixing/styling each platform until it looked nice.  However, I quickly noticed that I was running into more problems on the Android platform with my presentation layer. To save time, I decided to finish the iOS app before then fine tuning everything for Android.

Keep up with the latest news and issues and seek help in the community

While writing the app, I quickly found myself reading the Google Groups forum, the NativeScript blog, and Github Issues for the NativeScript project daily.  It was nice to read about new features, tutorials, and other findings that people had.  I also found the community to be pretty responsive to questions.  It was more productive to ask a question, and move onto another task, rather than spinning my wheels on one issue.

Note: Since writing this, NativeScript has launched a Slack community, which is another great resource for getting help.

Having knowledge of developing native apps would have been nice

I think that if I had more experience in developing native apps, I would have had a much easier time building the app.  There were many times when I was using a NativeScript plugin AND something would error that I could not debug.  I also ended up setting many of the properties on iOS objects directly with JavaScript, such as setting colors that were not editable via CSS. In other cases, I needed to change a property of an iOS property that was not accessible in a component.  Since I didn’t have much background in writing native apps, I had a harder time trying to figure out what was going on.

For iOS apps, be familiar with Xcode

This sort of relates to my previous point.  Toward the end of the project, I was in Xcode working on setting up Launch Screens, and setting other plist configuration options.  I also had to use Xcode to deploy to the App Store.

For more control over lists, use a Repeater instead of a ListView

I ran into a problem of having scrolling issues when I had 2 ListViews on the same screen.  I decided to use a Repeater instead. In general, I think using a Repeater can give you more flexibility in your layout.

Editor’s note: Although a repeater comes with more flexibility, it does not have many of the built-in optimizations ListViews have for dealing with large datasets. If you’re using a non-trivial amount of data, it’s worth sticking with the ListView.

Performance is great

I was fortunate that I did not have to use any webviews in this app.  I was able to find the NativeScript Telerik UI plugin which provided charting and side drawer capabilities for me.  All of my components were using Native iOS components, which resulted in a high performance app.

Find NativeScript plugins on NPM

The Telerik website has a list of tested plugins.  These are nice because you know that they have been thoroughly tested, but the list is very limited.  If you want to find additional plugins, search for “nativescript” on npm.  It will return a list of many plugins.  Although you have to use it at your own risk, you can often save a good amount of time from using a plugin.

Conclusion

Overall, I was happy using NativeScript.  I think my next time around at building an app would be much easier.  The product is still young, and with every release of NativeScript, I noticed that there were many new features and bug fixes that make me feel confident in the future of the product.

Comments