Upgrade to Pro — share decks privately, control downloads, hide ads and more …

tvOS for the iOS developer

Josh Brown
November 02, 2015

tvOS for the iOS developer

An overview of the similarities and differences between developing for tvOS and iOS

Josh Brown

November 02, 2015
Tweet

Other Decks in Programming

Transcript

  1. What's similar to iOS? → everything → Xcode, Interface Builder,

    Objective-C, Swift → frameworks (UIKit, Metal, CloudKit, Game Center, and more)
  2. What's different from iOS? → user interaction (Siri remote) →

    focus engine → a few missing parts → the App Store and assets → (new) TVML, JavaScript, TVMLKit → views & view controller appearance
  3. "A UI element is in focus when the user highlights

    an item, but has not selected an item."
  4. What do these have in common? → Photos framework →

    Multipeer Connectivity → EventKit → local storage → web views
  5. App Store: Required Assets → Layered icons: App Store, Home

    screen → Top Shelf Image → Launch image → Screen shots
  6. TVML and JavaScript 1. write some TVML (XML) & JavaScript

    2. put it on your server 3. write a TVMLKit app that points to your server 4. submit your TVMLKit app to Apple
  7. <document> <mainTemplate> <background> <img src="path to images on your server/Car_Movie_1920x1080"

    /> </background> <menuBar> <section> <menuItem> <title>PLAY</title> </menuItem> <menuItem> <title>SCENES</title> </menuItem> <menuItem> <title>EXTRAS</title> </menuItem> </section> </menuBar> </mainTemplate> </document>
  8. // application.js doc.addEventListener("play", startPlayback); // ... function startPlayback(event) { var

    player = new Player(); // ... player.playlist.push(video); // ... player.play(); }
  9. class AppDelegate: UIResponder, UIApplicationDelegate, TVApplicationControllerDelegate { var appController: TVApplicationController? static

    let TVBaseURL = "http://localhost:9001/" static let TVBootURL = "\(AppDelegate.TVBaseURL)js/application.js" func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // ... let appControllerContext = TVApplicationControllerContext() if let javaScriptURL = NSURL(string: AppDelegate.TVBootURL) { appControllerContext.javaScriptApplicationURL = javaScriptURL } appControllerContext.launchOptions["BASEURL"] = AppDelegate.TVBaseURL appController = TVApplicationController(context: appControllerContext, window: window, delegate: self) // ... }
  10. Further Reading tv Human Interface Guidelines 200MB Max, No Storage,

    No Web Views: Is tvOS the Future of Apps? Beginning tvOS Development with TVML Tutorial