
Apple TV Markup Language - hharnisch
https://developer.apple.com/library/prerelease/tvos/documentation/LanguagesUtilities/Conceptual/ATV_Template_Guide/TextboxTemplate.html#//apple_ref/doc/uid/TP40015064-CH2-SW8
======
jerf
If any of the authors are reading, you really ought to consider putting this
into an XML namespace. It can just be a mysterious invocation to most users
today, but if you need to extend this in the future (inline SVG? inline
XHTML?), it'll save your bacon to have done it in the first version.

~~~
mozumder
Why would anyone add complexity to the syntax when you can make it simpler by
removing the XML namespace?

If you need to add namespaces, then you have already failed.

~~~
SapphireSun
It's if you want to have backwards compatible syntax supported by later
devices. This will naturally happen as you add features and modify old ones.
It's even more important in hardware devices that might might not be able to
be updated later.

EDIT: I think someone is probably down-voting me for a technical reason. Would
you please explain it?

~~~
mderazon
If Apple wants to break BC they just do it. They control the entire ecosystem
and has been known to break stuff pretty frequently and force everyone to keep
up

~~~
sosborn
> been known to break stuff pretty frequently

Apple is really good about giving developers a heads up before deprecating
anything.

------
0x0
I believe this XML+JS thing was the only way to write apps for the old Apple
TV. Various postings on the internet seem to suggest this from way back; the
old SDK was probably only ever available to a select few handpicked appletv
channel partners.

What's new in the new tvOS SDK is that you can also write native apps in
Objective-C/Swift, with a main() function that starts up UIKit, and with
access to most of the normal iOS APIs (like OpenGL, SceneKit, etc etc).

~~~
msie
I was confused at first because TVML seemed more prominent in the
marketing/developer materials. But we just saw a game run on Apple TV so yeah,
you could write native apps w/o the TVML.

~~~
__abc
This was confusing for A LOT of people!!

------
philo23
This should be theoretically compatible with React right? I wonder if Netflix
are using this + React for their Apple TV app or if they're doing something
entirely different... There is a <divTemplate> option so perhaps its through
that?

------
usaphp
This is what looks like a css:
[https://developer.apple.com/library/prerelease/tvos/document...](https://developer.apple.com/library/prerelease/tvos/documentation/LanguagesUtilities/Conceptual/ATV_Template_Guide/ITMLStyles.html)

------
drhack
Oh look, it's XAML for an Apple device.

That's only half-sarcastic; it does seem to be a similar but much-simplified
markup language that learned a lot from HTML5. Will be interesting to watch it
develop.

As others have commented, though, XML without namespaces is not a fun ride (in
my humble experience).

[0]
[https://en.wikipedia.org/wiki/Extensible_Application_Markup_...](https://en.wikipedia.org/wiki/Extensible_Application_Markup_Language)

~~~
pjmlp
If XHTML had prevailed, we would already had XAML for the web, instead HTML
keeps getting hacks.

------
tcdent
I'm a little surprised they're jumping into the literal "TV" namespace so
wholeheartedly.

Is the future of this ecosystem really exclusively limited to the Television?

Gaming is already an explicit part of this, which undoubtedly will include VR,
which is theoretically suited to Television-like content.

If they do this right, the source code running on your VR gogs will mention
"TV" everywhere, much like the the current OS running their desktops and
mobile devices references a defunct company.

~~~
rjvir
The iPhone name worked out pretty well, even though the phone functionality is
just a small fraction of the iPhone's value proposition.

~~~
tcdent
Apple's phone SDK's are not prefixed "Phone", nor is it called the "Phone OS".

Exactly to my point: It's called iOS because the breadth of it's applicability
was recognized from the beginning.

Edit: You're right, and it's different: naming of the mobile OS and
namespacing were independent, allowing for a public re-brand without changing
any code. Seems the TV is not going that way though.

~~~
kposehn
Splitting hairs here: it was originally iPhone OS in the beginning, but moved
to iOS in June 2010

------
ezioamf
The main problem is that we are still using XML to do component definition and
composition. We need to better language (no, json and yaml are not the
answer).

I am working on a new language concept (still at early thinking) but the alert
template document would be defined as:

    
    
      alert#update_available [  //Composition is separated from definition
         btn#update,
         btn#cancel
      ]
    
      alert { //All alert elements are defined as alertTemplate
         type: alertTemplate
      }
    
      btn { //All btn elements are define as button
         type: button
      }
    
      alert#update_available { //Define the title and description for the alert with ID update_available
         title: Get the latest tvOS version
         description: Get the latest tvOS version
      }
    
      btn#update {
         text: Update Now
      }
    
      btn#cancel {
         text: Cancel
      }
    
      //We could override the settings like CSS
      (@language = "pt_br") { 
      //If variable language is pt_br override the content with Brazilian Portuguese texts
        btn#update {
           text: Atualize Agora
        }
    
        btn#cancel {
           text: Cancelar
        }
      }

------
ihsw
The link should probably be the main TVML page rather than one of the template
reference pages.

[https://developer.apple.com/library/prerelease/tvos/document...](https://developer.apple.com/library/prerelease/tvos/documentation/LanguagesUtilities/Conceptual/ATV_Template_Guide/index.html)

~~~
hharnisch
OP here - You're exactly right, I looked at that front page and almost bailed.
I thought this was much more interesting since it shows a simple example with
code and matching output screens.

------
nickchuck
I think it's interesting that Apple is promoting making apps that are web
based that you wouldn't have to get approval for to make updates. Maybe
because it's limited on you can do with TVML but I think it's interesting.

~~~
djrogers
I don't think that's what's happening here. Each of the TVML documents would
be stored locally and called by a locally stored TVJS file, which is invoked
by your binary.

In other words, all of the program logic and display elements are on the Apple
TV - only the data that's being retrieved and displayed would be stored
server-side - which is no different from any iPhone app that displays server
based content today.

~~~
nickchuck
No the app looks to an outside server for the code. Check out Apple's sample
code which makes you run the code on a python server.

------
Xero
So it's just HTML?

Is there a reason (legal or otherwise) that they can't just use HTML?

~~~
cleverjake
In no way is this html. its xml. they use xml for the same reason that most do
- to define their own elements and behaviors thereof

~~~
josteink
XML without namespaces, so pretty much just markup.

You know, without namespaces, you take out the eXtensibility-bit.

~~~
pilsetnieks
> pretty much just markup

SGML, actually. "Just markup" can entail other things, like TeX, for example.

------
ericcholis
Curious on why they chose an XML-like syntax rather than something like JSON

~~~
chillacy
XML is a markup language that can describe formatted document structure well,
json is best suited for things like data. For instance, this would be pretty
painful to describe in json:

<p>Hello, <strong>dave</strong></p>

Conversely, this is pretty painful to describe in XML:

<pair> <key>name</key> <value type="string">dave</value> </pair>

~~~
ericcholis
Good point, forgot about the display portion of this application

------
pbreit
So if you're building a simple media app, can you just use the templates and
JavaScript without much or any Swift/ObjectiveC? Sort of like Roku and Sonos?

------
mrfusion
So what's an example of something you could build with this?

~~~
phodo
Probably something like the MLB app they showed: \- Basic streaming \- various
ajax requests for score listings, etc. \- Plus some chrome / UI with app-
specific assets

------
bcruddy
Another mark up language? Why? What was wrong with HTML here?

~~~
steego
I'm not sure I'd qualify TVML as another mark up language. It looks like an
XML standard that adheres to a particular XML schema. Asking, "Another XML
schema?" would sound like a silly question because that's the whole point of
XML.

As for why not HTML? I think there's a lot of really good reasons why HTML
would be a poor choice. If you want to restrict Apple TV apps and channels to
rely on Apple approved idioms, HTML would be a terrible choice. Apple isn't as
interested in creating an open TV browser as much as it's interested in
creating a unique and positive TV experience. They can shape that with their
own standard.

