Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Getting Started with NativeScript
Getting Started with NativeScript

Getting Started with NativeScript: Explore the possibility of building truly native, cross-platform mobile applications using your JavaScript skill—NativeScript!

Arrow left icon
Profile Icon Anderson
Arrow right icon
NZ$26.99 NZ$38.99
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.2 (9 Ratings)
eBook Jan 2016 168 pages 1st Edition
eBook
NZ$26.99 NZ$38.99
Paperback
NZ$48.99
Subscription
Free Trial
Arrow left icon
Profile Icon Anderson
Arrow right icon
NZ$26.99 NZ$38.99
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.2 (9 Ratings)
eBook Jan 2016 168 pages 1st Edition
eBook
NZ$26.99 NZ$38.99
Paperback
NZ$48.99
Subscription
Free Trial
eBook
NZ$26.99 NZ$38.99
Paperback
NZ$48.99
Subscription
Free Trial

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Getting Started with NativeScript

Chapter 2. The Project Structure

In this chapter, I am going to show you how to navigate your new project and its full structure. I will explain each of the files that are automatically created and where you create your own files. Then, we will proceed to gain a deeper understanding of some of the base components of your application, and finally, learn how to change screens.

In this chapter, we will be covering the following topics:

  • Project directory overview
  • App directory overview
  • NativeScript common core files
  • Your application files
  • An application page
  • Foundational components
  • Creating a second page
  • Navigating between screens

Project directory overview

By running the nativescript create crossCommunicator command in the previous chapter, it created a nice structure of files and folders for us to explore.

Note

If the NativeScript team has replaced the default project template since this book was written, the actual source code as it existed at the time of publishing is located in the book's source code repository found at https://github.com/GettingStartedWithNativeScript/Chapter_1. The Example_1 folder contains the entire default template when this book was written. And you can clone it to your hard drive by running the git clone https://github.com/GettingStartedWithNativeScript/Chapter_1 command and then proceeding to follow along inside the Example_1 folder.

First, we will do a high-level overview of the different folders and their purposes and touch on any important files in those folders. Then, we will finish the overview by going into depth with the App directory, which is where you will spend pretty much...

The app folder

Wow! As you can see, a lot of stuff goes on just to create an application. Now, we are going to finally discuss the App folder structure; this folder is where we will spend the majority of our development time. We shall explore what the different types of files are for and how they are used to create an application. Since this is the primary development folder and contains your entire code base for your application, I would highly recommend you put this folder under source control and/or maintain backups of this folder. The App folder already contains a couple folders and a few files that are mentioned under the App folder files subsection. Let's look at both of these folders first and the files contained in them, and finally, we will look at each of the individual files in the App folder.

The .gradle folder

This folder is for the gradle build system; it basically only contains cache and data items that are used while the application is being built. This folder might be...

Foundational components

Now that we have explored all the project files that were automatically created for you, let's examine several foundational components that have already been referenced in the main page. These components are the glue of the application, and without them, we would have no application.

Application component

If you recall, earlier in the chapter, we discussed the app.js file. It basically contains only the code that is responsible for setting up the properties of your application and then finally, it starts the application component. So, you probably have guessed that this is the primary component for your entire application lifecycle. Part of the features that this component provides us with is access to all the application-wide events. Frequently, in an app, you will want to know when your app is no longer the foreground application or when it finally returns to being the foreground application. To get this information, you can attach to two of the events that...

Creating a second page

Now that we have an idea of all the project files and foundational components, why don't we do something cool and finish off this chapter by creating a brand new page and then using our newfound skills to navigate to it?

Creating additional files and pages

Some people might prefer individual subdirectories per page or some other project layout scheme. NativeScript has no issues with you creating your project system the way you want. For our project, and to keep things simple, we are just going to add any new files to our main app directory. To create a new page, we just need to create the files associated with a page. So, in this case, we need to create a single new file called settings.js in our main App folder. And then, finally, we need to make a change to the main-view-model.js file to show our new page.

Creating settings.js

In our application, we are going to need a settings page, so we are going to create the framework for our application settings page right...

Summary

We have covered a large amount of foundational information in this chapter. Not only did we go through all the project files that were created by the tns create crossCommunicator command, but we also covered which files are used for your application and where to find and make any changes to the project control files. In addition, we also covered several foundational components such as the Application, Frame, and Page components. And we walked through the three different files that make up an application page. Finally, we created a new page and navigated to it and back from it.

In the next chapter, we are going to cover several more components and explore the XML Declarative UI and flesh out binding and observables, working with events, and styling your application with CSS.

Left arrow icon Right arrow icon

Key benefits

  • Save your marketing time by building for iOS, Android, and Windows Mobile platforms simultaneously
  • Be an ace at utilizing the features of NativeScript and its ability to communicate with each of the host device libraries natively
  • Proficiently, build your fully cross-platform communication application exhibiting the fundamentals of NativeScript

Description

NativeScript allows you to build a fast cross-platform application that has a native UI. NativeScript is a true cross-platform framework that generates native speed applications using the native components of the host platform, all using JavaScript. Although NativeScript allows you to build your application in JavaScript, you have full access to the host OS from your code, allowing you to easily tweak or use new platform features instantly at native code speeds. Whether you have already developed multiple applications or zero applications, this book will help you to develop your next application in a cross-platform framework quickly, saving you a massive amount of time and money. This book concisely shows you NativeScript’s built-in framework that allows you to rapidly develop a fully-working compiled cross-platform application in just a few chapters. It starts by laying the foundation of NativeScript and working through the fundamentals to create a basic shell of the application. Moving on, you’ll see how to build a full-fledged application step by step. We’ll show you how to use plugins, and how to communicate with the native OS libraries easily so that you can customize your application as if your app was created in Java or Objective C. We then deal with the issues that arise from being cross platform and compensate for the different screen sizes, screen resolutions, and device abilities. Finally, we progress to testing and deploying your app.

Who is this book for?

If you are a JavaScript developer and want to build cross-platform applications, then this book is just the right one for you!

What you will learn

  • Install and compile your application in NativeScript
  • Get important know-how on the NativeScript project structure
  • Develop and style your screens for multiple platforms
  • Create a full-featured cross-platform communication application
  • Import and use several third-party components
  • Simplify and deal with device resolution and cross-platform issues
  • Test and deploy your application

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jan 28, 2016
Length: 168 pages
Edition : 1st
Language : English
ISBN-13 : 9781785889356
Vendor :
Progress
Category :
Languages :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Jan 28, 2016
Length: 168 pages
Edition : 1st
Language : English
ISBN-13 : 9781785889356
Vendor :
Progress
Category :
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just NZ$7 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just NZ$7 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total NZ$ 120.98
Getting Started with NativeScript
NZ$48.99
NativeScript for Angular Mobile Development
NZ$71.99
Total NZ$ 120.98 Stars icon
Banner background image

Table of Contents

8 Chapters
1. Introduction to NativeScript Chevron down icon Chevron up icon
2. The Project Structure Chevron down icon Chevron up icon
3. Declarative UI, Styling, and Events Chevron down icon Chevron up icon
4. Building a Featured Application Chevron down icon Chevron up icon
5. Installing Third-Party Components Chevron down icon Chevron up icon
6. Platform Differences Chevron down icon Chevron up icon
7. Testing and Deploying Your App Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.2
(9 Ratings)
5 star 33.3%
4 star 22.2%
3 star 11.1%
2 star 0%
1 star 33.3%
Filter icon Filter
Top Reviews

Filter reviews by




Alex Jun 17, 2016
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The author, being one of the leading community developers with NativeScript, clearly and logically take the reader on a real learning journey. What I love about this book is that it not only covers the essentials, but also goes deeper with some tried and tested real world knowledge, including tips and tricks, as well as different caveats that could potentially catch a freshman NativeScriptie off-guard. Looking forward to the next one!
Amazon Verified review Amazon
stevescotthome Jun 01, 2016
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Great primer!l
Amazon Verified review Amazon
Ehrlichwährtamlängsten Mar 24, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Ich finde das Buch klasse. Es ist kompakt geschrieben, hat einen roten Faden und führt vollständig in NativeScript ein. Zudem schafft es der Autor immer wieder, zur rechten Zeit einen erfrischenden und gelungenen Joke einzuwerfen und den Leser bei Laune zu halten; eigentlich mag ich so was gar nicht, aber hier ist der Schreibstil definitiv gelungen und überaus informativ. Auch die Code-Beispiele sind exzellent; sie sind aufs wesentliche beschränkt und ohne Probleme nachfollziehbar.Sollte eine Neuauflage zur bevorstehenden Version 3 erscheinen, würde ich mir dies ebenfalls noch einmal und schnellstmöglichst bestellen. Ansonsten fühle ich mich mit diesem Buch bestens gerüstet und danke dem Autor für dieses liebevolle Werk.Ich wüsste nicht, warum ich stattdessen 400 oder 500 Seiten mit gleichem, dafür in die Länge gezogenen Inhalt lesen sollte. Sollte der Autor es jedoch schaffen, in einer Folgeauflage 400 oder 500 Seiten bei gleicher Qualität zu schreiben und diese eventuell sogar in ein farbig gedrucktes Buch zu stecken, dann würde ich auch ohne zögern den doppelten Preis zahlen (28 Euro aktuell / 50 dann o.ä.) ;-)Die 5 Sterne vergebe ich trotzdem schon, weil es sich eben um knapp 170 absolut informative und gut geschriebene Seiten zu einem noch akzeptablen Preis handelt und weil mir der Einstieg hiermit mehr als gut gelungen ist :-)
Amazon Verified review Amazon
Ahmed B. Feb 17, 2016
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Good book for a getting started book, but I was looking for a real-life examples such as Instagram/snap/YouTube.
Amazon Verified review Amazon
Joshie wah wah Sep 11, 2020
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
I built a cross communicator and chatted between my mobile device and browser which is pretty cool! Certainly feel more comfortable building mobile chat apps. It is outdated now so took some work as some of the library's have changed etc. I love the way this guy has a laugh whilst teaching this stuff, after all web sockets and all that jazz can get a little tiresome.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.