SlideShare a Scribd company logo
GAME ON!
WITH
NATIVESCRIPT
J E N L O O P E R | D E V R E L @ T E L E R I K
@ J E N L O O P E R
$ WHOAMI
• Ph.D. … in Medieval French (13th
century prose romance FTW)
• Retrained!
• Worked in startup, nonprofit, big
corporate 14 yrs+
• A lot of side projects –
ladeezfirstmedia.com
• Now DevRel@Telerik
WHAT IS
NATIVESCRIPT?
A RUNTIME FOR BUILDING AND RUNNING
NATIVE IOS, ANDROID, AND (SOON)
WINDOWS PHONE APPS WITH A SINGLE,
JAVASCRIPT CODE BASE
Game On With NativeScript
• No cross
compilation
!
=
!
=
• Direct access to
native APIs in JS
!
=
• No DOM
WHY NATIVESCRIPT?
• Skills reuse
• Standards-based JavaScript, CSS, optionally TypeScript
• Code reuse
• npm modules, 3rd-party iOS and Android libraries
• Easily use native APIs
• No wrappers to access native APIs
• Use native UI elements
• Open source!
CONTRIBUTE!
(NATIVESCRIPT.ORG/CONTRIBUTE)
Game On With NativeScript
NATIVESCRIPT ANDROID EXAMPLE
Output:
NATIVESCRIPT IOS EXAMPLE
Game On With NativeScript
HOW DOES THIS WORK?
NATIVESCRIPT AND JS VMS
NativeScript runs JavaScript on a JavaScript
VM
•JavaScriptCore on iOS
•V8 on Android
Game On With NativeScript
• Runs on JavaScriptCore
• Runs on V8
Game On With NativeScript
Game On With NativeScript
NATIVESCRIPT MODULES
• NativeScript-provided modules that
provide cross-platform functionality.
• There are dozens of them and they’re
easy to write yourself.
• NativeScript modules follow Node
module’s conventions (CommonJS).
NATIVESCRIPT FILE MODULE
NATIVESCRIPT HTTP MODULE
COMMUNITY MODULES
NEW! PLUGIN MARKETPLACE!
BUT HOW DO I TURN THIS INTO AN APP?
2 WAYS TO USE NATIVESCRIPT
1)
2)
• Backend-as-a-service
– Push notifications, cloud data, file storage, etc
• Analytics
• AppBuilder
– Cloud builds (build iOS apps on Windows, Windows Phone apps on a Mac)
– NativeScript debugging and tooling
• Screen Builder (app scaffolding)
• And more!
http://telerik.com/platform
•In-Browser Client
•Visual Studio Extension
•Sublime Text Package
•Command-Line Interface
TELERIK APPBUILDER IDE OPTIONS
Game On With NativeScript
PRICING
https://www.telerik.com/purchase/appbuilder
NATIVESCRIPT CLI
•Free and open source
•https://github.com/nativescript/nativescri
pt-cli
NATIVESCRIPT CLI REQUIREMENTS
https://github.com/nativescript/nativescript-
cli#system-requirements
• Xcode, Xcode CLI tools, iOS SDK
• JDK, Apache Ant, Android SDK
LEARN MORE!
NativeScript Getting Started Guide:
http://docs.nativescript.org/getting-started
STARTING A NEW PROJECT
RUNNING ON IOS
RUNNING ON ANDROID
DEVELOPER HELPS!
1. Livesync!
2. Sublime Text Settings to build
3. Deploy to device
Cmd + B
APP STRUCTURE
APP.JS
PAGES
• XML markup structure
• Elements (e.g. <Page>, <Label>) are NativeScript
modules
CUSTOM XML COMPONENTS
http://docs.nativescript.org/ui-with-xml#custom-components
DATA BINDING
DATA BINDING IMPROVED
CSS
http://docs.nativescript.org/styling#supported-properties
CSS
LET’S BUILD SOMETHING!
A GAME INSPIRED BY…
• Show picture of llama or duck
• Very quickly timeout
• Show high scores
LET’S USE THE CLARIFAI API TOO!
A souped-up Llama vs. Duck with educational
++
• Pick 2 images
• Query Clarifai to get 2 sets of tags
• Create game loop to let user choose This or That
• Localize the tags using Clarifai’s translations (20 languages!)
(Settings area)
• Timeout after 5 seconds
• Show high scores (Telerik Platform integration)
• Show my scores (also Telerik Platform)
PRESENTING…
THISORTHAT:
A GAME OF WORDS AND TAGS
O P E N S O U R C E !
Android
download
https://github.co
m/jlooper/thisort
hat-app
iOS download
THISORTHAT: CODE WALKTHROUGH
• Basic structure
• API integration
• Authentication
• View models
• Shared code
• Animation
• Platform-specific code
• Cocoapods and Toast plugin
• Npm module – email-
validator
THISORTHAT:
BASIC CODE STRUCTURE
• Quick code structure rundown
THISORTHAT: API INTEGRATION
• Shared/config.js
• Data persistence
THISORTHAT: AUTHENTICATION
• Login
• Password
• Register
THISORTHAT: VIEW MODELS
• Shared/view-models/game-view-model.js
• Shared/view-models/user-view-model.js
THISORTHAT: SHARED CODE
• Shared/navigation.js
• Shared/utils/form-util.js
THISORTHAT: ANIMATION
• Nativescript’s built-in animation library
THISORTHAT: IMAGES
• Content-scaled images
• Non-content-scaled images
THISORTHAT: PLATFORM-SPECIFIC
CODE
• CSS
• Utils/action-bar-util.js
• Utils/form-util.js
• Inline: login/login.js
THISORTHAT: COCOAPODS AND NPM
MODULES
• fancyAlert (YCTutorialBox)
• email-validator (generic npm module)
• Nativescript-toast (nativescript-based npm modules)
LET’S PLAY!
H M U !
Jen Looper
@jenlooper
jen.looper@telerik.co
m
Learn more about
NativeScript at the Telerik
booth and at
nativescript.org

More Related Content

PDF
Experiences building apps with React Native @DomCode 2016
PPTX
Building mobile apps with PhoneGap and Titanium appcelerator
PPTX
Angular 2 and NativeScript
PDF
A brief intro to RubyMotion
PPTX
Continuous integration by Rémy Virin
PDF
Your choices for building a mobile app in 2016
PDF
Experiences building apps with React Native @UtrechtJS May 2016
PPTX
Introduction to NativeScript - BuildTruly Native Apps using JavaScript
Experiences building apps with React Native @DomCode 2016
Building mobile apps with PhoneGap and Titanium appcelerator
Angular 2 and NativeScript
A brief intro to RubyMotion
Continuous integration by Rémy Virin
Your choices for building a mobile app in 2016
Experiences building apps with React Native @UtrechtJS May 2016
Introduction to NativeScript - BuildTruly Native Apps using JavaScript

Similar to Game On With NativeScript (20)

PDF
React Native? A developer's perspective
PDF
[Srijan Wednesday Webinars] Building Full-Fledged Native Apps Using RubyMotion
PDF
NativeScript: Cross-Platform Mobile Apps with JavaScript and Angular
PDF
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 09)
PDF
Cordova 101
PPTX
Rise of the hybrids
PPTX
Cross-Platform Development
PDF
Xamarin v.Now
PPTX
Ignite your app development with Angular, NativeScript and Firebase
KEY
Eating Fruit - Combining Robots & Apps
PDF
JavaScript: Past, Present, Future
PPTX
NativeScript - Open source framework for building truly native mobile apps wi...
PPTX
Mobile native-hacks
PPT
Joomla as a mobile App backend - ideas, examples and experiences
PDF
Mono for Android... for Google Devs
KEY
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
PPTX
مدخل برمجة صعيدي جيكس
PDF
Web technologies for desktop development @ berlinjs apps
KEY
PPT
Native App Development for iOS, Android, and Windows with Visual Studio
React Native? A developer's perspective
[Srijan Wednesday Webinars] Building Full-Fledged Native Apps Using RubyMotion
NativeScript: Cross-Platform Mobile Apps with JavaScript and Angular
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 09)
Cordova 101
Rise of the hybrids
Cross-Platform Development
Xamarin v.Now
Ignite your app development with Angular, NativeScript and Firebase
Eating Fruit - Combining Robots & Apps
JavaScript: Past, Present, Future
NativeScript - Open source framework for building truly native mobile apps wi...
Mobile native-hacks
Joomla as a mobile App backend - ideas, examples and experiences
Mono for Android... for Google Devs
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
مدخل برمجة صعيدي جيكس
Web technologies for desktop development @ berlinjs apps
Native App Development for iOS, Android, and Windows with Visual Studio
Ad

More from Jen Looper (19)

PPTX
The Last Saree: AI and Material Culture
PPTX
Computer Science for Kids: A Storytelling Approach
PPTX
Staying Fresh and Avoiding Burnout
PPTX
NativeScript and Angular
PPTX
Sharing Code between Web and Mobile Apps
PDF
Beacons, Plants, Boxes
PPTX
Hackathon Slides
PPTX
Using Beacons in a Mobile App - IoT Nearables
PPT
Swipe Left for NativeScript
PPTX
Crafting an Adventure: The Azure Maya Mystery
PPTX
Re-Building a Tech Community - Post Pandemic!
PPTX
Building a Tech Community in Ten Easy Steps
PPTX
Becoming a Green Developer
PPTX
Azure Static Web Apps
PPTX
Creating a Great Workshop
PPTX
The Ethics of Generative AI: A Humanist's Guide
PPTX
Zero to Hipster with the M.I.K.E. Stack
PPTX
Telerik AppBuilder, Estimote Beacons, and the IoT - Presentation for TelerikNEXT
PPTX
Telerik AppBuilder Presentation for TelerikNEXT Conference
The Last Saree: AI and Material Culture
Computer Science for Kids: A Storytelling Approach
Staying Fresh and Avoiding Burnout
NativeScript and Angular
Sharing Code between Web and Mobile Apps
Beacons, Plants, Boxes
Hackathon Slides
Using Beacons in a Mobile App - IoT Nearables
Swipe Left for NativeScript
Crafting an Adventure: The Azure Maya Mystery
Re-Building a Tech Community - Post Pandemic!
Building a Tech Community in Ten Easy Steps
Becoming a Green Developer
Azure Static Web Apps
Creating a Great Workshop
The Ethics of Generative AI: A Humanist's Guide
Zero to Hipster with the M.I.K.E. Stack
Telerik AppBuilder, Estimote Beacons, and the IoT - Presentation for TelerikNEXT
Telerik AppBuilder Presentation for TelerikNEXT Conference
Ad

Recently uploaded (20)

PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PDF
ETO & MEO Certificate of Competency Questions and Answers
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
Strings in CPP - Strings in C++ are sequences of characters used to store and...
PPTX
Lesson 3_Tessellation.pptx finite Mathematics
PDF
Arduino robotics embedded978-1-4302-3184-4.pdf
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
AgentX UiPath Community Webinar series - Delhi
PPTX
24AI201_AI_Unit_4 (1).pptx Artificial intelligence
PPTX
436813905-LNG-Process-Overview-Short.pptx
PPTX
Geodesy 1.pptx...............................................
PDF
Structs to JSON How Go Powers REST APIs.pdf
PDF
오픈소스 LLM, vLLM으로 Production까지 (Instruct.KR Summer Meetup, 2025)
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
MET 305 MODULE 1 KTU 2019 SCHEME 25.pptx
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
UNIT-1 - COAL BASED THERMAL POWER PLANTS
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
ETO & MEO Certificate of Competency Questions and Answers
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Embodied AI: Ushering in the Next Era of Intelligent Systems
Strings in CPP - Strings in C++ are sequences of characters used to store and...
Lesson 3_Tessellation.pptx finite Mathematics
Arduino robotics embedded978-1-4302-3184-4.pdf
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
AgentX UiPath Community Webinar series - Delhi
24AI201_AI_Unit_4 (1).pptx Artificial intelligence
436813905-LNG-Process-Overview-Short.pptx
Geodesy 1.pptx...............................................
Structs to JSON How Go Powers REST APIs.pdf
오픈소스 LLM, vLLM으로 Production까지 (Instruct.KR Summer Meetup, 2025)
Model Code of Practice - Construction Work - 21102022 .pdf
MET 305 MODULE 1 KTU 2019 SCHEME 25.pptx
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT

Game On With NativeScript

Editor's Notes

  • #11: this JavaScript code instantiates a Java android.text.format.Time() object, calls its set() method, then logs the return value of its format() method, which is the string "01/01/15".
  • #12: This JavaScript code instantiates an Objective-C UIAlertView class, sets its message property, and then calls its addButtonWithTitle() and show() methods. When you run a NativeScript iOS app with this code you'll see the alert "hello world!"
  • #13: Use native classes which you can find in the native documentation to craft your nativescript code
  • #15: NativeScript is a runtime that leverages platform-specific JavaScript engines (javascriptcore and V8)
  • #21: this filesystem module allows you to pass through a path that you define as a parameter. On Android a new file will be created at that location, and on iOS we instantiate the NSFileManager as the default manager and tell it to create the file on that path. All with one require and one line of javascript.
  • #22: the http module allows you to make http calls and return json results.
  • #30: free 30 day trial
  • #37: Do this live – show livesync Show sublime build script Preferences > Browse Packages > User/nativescript.sublime-build
  • #42: Use the load function to bind data to an xml element
  • #43: Or use the observable module to take care of it – mvvm people will feel comfortable.
  • #47: Played by pewdiepie and became popular
  • #48: http://clarifai.com/#demo