2 Your first app

 

This chapter covers

  • The NativeScript runtime
  • The NativeScript development workflow
  • The NativeScript CLI
  • Your first NativeScript app

In chapter 1, you were introduced to NativeScript. You learned that NativeScript provides you a way to write your app code once and deploy your app to multiple platforms (iOS and Android). You also learned that you can use your existing development knowledge of XML, JavaScript, and CSS to create NativeScript apps. Now it is time for you to take a closer look at NativeScript and write your first app!

TIP

When learning to develop cross-platform mobile apps, you should choose a single device to test on during your initial development. This is important because you don’t want to lose focus on the creation of your app by testing on too many platforms at once. As you finish developing each feature of your app, stop and test your application on various devices. Once you’re satisfied the feature works across all platforms, then return to a single device for further development.

Throughout the book, we’ve chosen to develop and test our apps on an iPhone 6, so you’ll see a lot of iPhone screenshots. When it makes sense, we’ll include a side-by-side comparison of the same app code running on Android. Just because we’re starting with an iPhone doesn’t mean you have to as well: use the platform you’re familiar with because it will make testing easier.

2.1   Hello world

2.1.1   NativeScript CLI

2.1.2   Using the CLI to scaffold your project

2.1.3   Initial platform and development tools

2.1.4   Adding and removing platforms

2.1.5   Running your app in an emulator

2.2   NativeScript apps

2.2.1   The NativeScript runtime

2.2.2   JavaScript virtual machines

2.2.3   JavaScript virtual machines in NativeScript

2.3   Establishing your development workflow

2.3.1   Building NativeScript apps

2.3.2   Livesync

2.4   Quick reference

2.5   Summary

2.6   Exercise

2.7   Solutions