In September 2015 at WWDC event, Apple introduced the most powerful and advanced updates to the Apple TV set-up box. It provides simple, most effective and handy user interfaces to the users for navigating and viewing video content. It also supports other third-party applications and games named as tvOS applications. Apple’s 4th generation TV hardware includes:
- 64-bit A8 processor
- Siri enabled remote
- 1080p resolution
- 32GB or 64GB of storage
- 2GB RAM
Apple has provided two ways to develop tvOS app:
- TVML Apps: Apple introduced new TVML framework which is a client-server based app that includes TVML, TVJS, and TVML kit.
- Custom Apps: These custom apps are developed in the same manner as for iOS. Examples are Storyboard, UIKit, Outlets, Actions, etc.
It’s totally up to you while choosing the platform for your app. TVML Apps are client-server apps i.e., you have data on a server which you want to show to the users whereas Custom TV Apps are customizable as other iOS apps with impressive and sophisticated user interface, animations, auto layouts, navigations, etc.
As mentioned, we can develop client-server based apps via TVML, TVJS, and TVMLKit.
TVML(Television Markup Language): As the name suggest, it’s a markup language, i.e., a form of XML. Apple provides various kind of premade templates which you can easily find on Apple’s developer website.
We hope that now you would have gained enough idea to create your first app on tvOS but remember to always have Xcode 7.1 or later before starting the development work.
To do that, open your Xcode and select “Create a new Xcode project” or go to Xcode’s “File\New\Project” and select the “tvOS\Application\TVML Application” and click “Next” button.
For the Product Name, enter FirstTVDemo (anything you want to) and select Language ‘Swift’ and uncheck both boxes and click Next and choose any directory to save your project. After saving that project open AppDelegate file, you will find some additional code in didFinishLaunchingWithOptions method.
After viewing this, the questions which should arise in your mind are:
- If it is a client – server based app where we need to set up Server?
- Where do we need to store TVML templates?
- How can we access it using TVJS?
So, here are the answers, Open your AppDelegate file, you will find appController, tvBaseURL, and tvBootURL.
Here it is simply calling the createAlert method for showing simple alert to display on the screen.
createAlert is a function that returns a TVML document. It includes alertString TVML string (in this case we are using alertTemplate from premade templates provided by Apple) its same as UIAlertView.
Now, when I run application I got an error :
python -m SimpleHTTPServer 9001
Just need to drag application.js parent folder path to the terminal and then start our SimpleHTTPServer server because it is a good option that is started by command and replace port with the real value you want. And now just run your app and you will find:
Cheers! You have made your first TV app. Its simply an alertTemplate template from 18 different kinds of templates provided by Apple. However, you can try different templates as well.