tns create todo
tns platform add ios
tns run ios
- Make sure do not include /platforms folder in git, cause the size is very big and also it's used for local development only and if you use npm modules, i think you need include it in .gitignore along side with platforms folder.
git remote add origin <git url>
git add --all
git commit -m "Initial Commit"
git push -u origin master
Before we begin, we must understand the basic concept below:
- MVVM pattern for developing the NativeScript apps
- Folder Struckture (source)
These knowledges are for the best practices when building NativeScript. And if you do not want manually create that folder structures each time you begin the project, i think you should check this link
Part 1 - Steps:
Let's begin with creating TODO Model.
Name it to Todo.js and save it to app/shared/models/ folder.
Then we build View Model for TODO apps
name it to todoData.js and save it to app/views/ folder.
The next step we create View and binding the data from todo view model into the view. And common TODO application uses list for the layout, so in this case we using ListView Binding
- And then we should test and run the apps, you can use emulator
tns run ios --emulator/
tns run android --emulator
or direct to your android or iOS phone using USB, in this example i did use iphone 5 to run it.
tns run ios
For this Part 1 we did created basic MVVM pattern which is needed for building apps in NativeScript, and i know its still far to be called TODO apps, so stay tune for the Part 2.