30
Introduction to the new Apple TV and tvOS Skype : alex.ozun e-mail: [email protected] Oleksii Ozun iOS Developer

Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"

Embed Size (px)

Citation preview

Page 1: Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"

Introduction to the new Apple TV and tvOS

Skype : alex.ozun e-mail: [email protected]

Oleksii Ozun iOS Developer

Page 2: Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"

• Platform overview• Client-Server vs Traditional Apps• Parallax effect• Platform limitations• Demo

tv Agenda

Page 3: Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"

tv

Platform overview

Page 4: Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"

• 64-bit dual-core A8 chip• 2GB RAM• 32GB or 64GB of storage• 1080p resolution• HDMI 1.42• USB-C

149$

32GB199$

64GB

tv Specs

Page 5: Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"

Touch surface Accelerometer Gyroscope

Menu Home

Siri

Play/PauseVolume

tv Siri remote

Page 6: Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"

tv 3rd party remotes

Babushka remotesSteelSeries Nimbus

Page 7: Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"

tv

Client-Server vs Traditional apps

Page 8: Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"

Accelerate AudioToolbox AudioUnit AVFoundation AVKit CFNetwork CloudKit CoreBluetooth CoreData CoreFoundation CoreGraphics CoreImage CoreLocation CoreMedia

ModelIO OpenGLES SceneKit Security simd SpriteKit StoreKit Swift Standard Library SystemConfiguration UIKit

CoreSpotlight CoreText CoreVideo Darwin

GameKit GameplayKit GLKit ImageIO MachO MediaAccessibility MediaPlayer MediaToolbox Metal MetalKit MetalPerformanceShaders MobileCoreServices

Foundation GameController

tv Traditional apps

Good Old iOS Frameworks

Page 9: Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"

tv

I know how to program Apple TV!

Traditional apps

Page 10: Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"

tv Client-Server apps

Your App’s business logic, layouts and data live on a

remote server

Page 11: Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"

tv Client-Server apps

Your App’s business logic, layouts and data live on a

remote server

While Xcode project’s binary is just an entry

point

Page 12: Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"

tv Client-Server apps

TVML - Apple’s Television Markup Language. Provides a set of pre-designed templates for creating layouts for pages.

TVJS - JavaScript framework. Provides a set of APIs for creating client-server app.

TVMLKit - Obj-C/Swift framework. Glues TVML and TVJS files to your Xcode project’s binary.

TV Services - Obj-C/Swift framework. Used to provide a tvOS with content of your app in a way that tvOS could display it to user.

Page 13: Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"

tv Client-Server apps

TVML - Apple’s Television Markup Language. Provides a set of pre-designed templates for creating layouts for pages.

TVJS - JavaScript framework. Provides a set of APIs for creating client-server app.

TVMLKit - Obj-C/Swift framework. Glues TVML and TVJS files to your Xcode project’s binary.

TV Services - Obj-C/Swift framework. Used to provide a tvOS with content of your app in a way that tvOS could display it to user.

Page 14: Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"

tv Client-Server apps

TVML - Apple’s Television Markup Language. Provides a set of pre-designed templates for creating layouts for pages.

TVJS - JavaScript framework. Provides a set of APIs for creating client-server app.

TVMLKit - Obj-C/Swift framework. Glues TVML and TVJS files to your Xcode project’s binary.

TV Services - Obj-C/Swift framework. Used to provide a tvOS with content of your app in a way that tvOS could display it to user.

Page 15: Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"

tv Client-Server apps

TVML - Apple’s Television Markup Language. Provides a set of pre-designed templates for creating layouts for pages.

TVJS - JavaScript framework. Provides a set of APIs for creating client-server app.

TVMLKit - Obj-C/Swift framework. Glues TVML and TVJS files to your Xcode project’s binary.

TV Services - Obj-C/Swift framework. Used to provide a tvOS with content of your app in a way that tvOS could display it to user.

Page 16: Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"

tv Client-Server apps

After your app has been launched by TVMLKit, it is javascript that drives pages flow

Page 17: Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"

tv Client side

TVApplicationControllerContext - provides launch information to the TV application controller

TVApplicationController - establishes the JavaScript environment and provides a centralized point of control and coordination between the JavaScript environment and tvOS

Page 18: Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"

tv Client side

TVApplicationControllerContext TVApplicationControllerContext *appControllerContext = [TVApplicationControllerContext new];

appControllerContext.javaScriptApplicationURL = [[NSURL alloc] initWithString:@«http://localhost:9001/app.js"];

appControllerContext.launchOptions = @{@"BASEURL": @"http://localhost:9001/"};

Page 19: Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"

tv Client side

TVApplicationControllerTVApplicationController *appController = [[TVApplicationController alloc] initWithContext:appControllerContext window:self.window delegate:self];

@property (nonatomic, readonly) UINavigationController *navigationController;

Page 20: Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"

tv Server side

App.onLaunch = function (options) { var resourceLoader = new ResourceLoader(); resourceLoader.loadResource(`Index.xml.js`, function(resource) {

var doc = Presenter.makeDocument(resource); navigationDocument.pushDocument(doc); });

App class - provides access to and a means to respond to app life cycle events

main.js

App.onError

App.onExit

}

Page 21: Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"

tv Server side

NavigationDocument class - provides functions that you use to control the document stack that holds the individual TVML documents for a client-server app

main.js

navigationDocument.pushDocument(document)

navigationDocument.popDocument(document)

navigationDocument.replaceDocument(document)

navigationDocument.presentModal(document)

Page 22: Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"

tv TVML template example

<alertTemplate> <title>Title</title> <description>Description</description> <button> <text>Button</text> </button> </alertTemplate>

Alert view template

Page 23: Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"

tv TVML template exampleCatalog page template

<catalogTemplate> <banner> <title>Title</title> </banner> <list> <section>

<listItemLockup> … </listItemLockup>

<listItemLockup> … </listItemLockup>

</section> </list> </catalogTemplate>

Page 24: Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"

tv Parallax images

Page 25: Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"

tv Parallax imagesParallax effect is a key design element in tvOS

Page 26: Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"

tv Parallax images

How to create one

• Install Parallax Exporter plug-in for Photoshop • Download Apple-provided template • Create layered image and export it as .lsr • Drag it to Xcode image assets

OR • Drag few .png to Xcode to serve as image layers

Page 27: Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"

tv Parallax images

How to create one at runtime

If your app retrieves layered images from a content server at runtime, you must provide those images in runtime layered image .lcr format. You don’t create runtime layered images directly; you generate them from .lsr or Photoshop files using the layerutool command-line tool that’s installed with Xcode

Page 28: Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"

tv Platform limitations

• No persistent local storage for your apps • App size limit is 200 MB • No 4K

Page 29: Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"

Lets get to the Demo!

Page 30: Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"

Linkshttps://developer.apple.com/library/prerelease/tvos/documentation/TVServices/Reference/TVServices_Ref/index.html

https://developer.apple.com/library/prerelease/tvos/documentation/TVMLKit/Reference/TVMLKit_Collection/index.html

https://developer.apple.com/library/prerelease/tvos/documentation/LanguagesUtilities/Conceptual/ATV_Template_Guide/index.html

https://developer.apple.com/library/prerelease/tvos/documentation/TVMLJS/Reference/TVJSFrameworkReference/index.html