Save 37% off PRO during our Black Friday Sale! »

Bring your apps to the big screen 📺

Bring your apps to the big screen 📺

An introduction to building tvOS apps, given at Swift Summit SF 2015.

9d2ea021919ff81e02d48530aae191bd?s=128

Boris Bügling

October 30, 2015
Tweet

Transcript

  1. BRING YOUR APP TO THE BIG SCREEN SWIFT SUMMIT, OCTOBER

    2015 BORIS BÜGLING - @NEONACHO
  2. None
  3. COCOAPODS

  4. CONTENTFUL

  5. None
  6. None
  7. “‘I’d like to create an integrated television set that is

    completely easy to use,’ he told me. [...] ‘It will have the simplest user interface you could imagine. I finally cracked it.’”
  8. OCTOBER 21, 2011

  9. SEPTEMBER 9, 2015

  10. None
  11. None
  12. The future of TV is iOS

  13. Accelerate AudioToolbox AudioUnit AVFoundation AVKit CFNetwork CloudKit CoreBluetooth CoreData CoreFoundation

    CoreGraphics
  14. CoreImage CoreLocation CoreMedia CoreSpotlight CoreText CoreVideo Darwin Foundation GameController GameKit

    GameplayKit
  15. GLKit ImageIO MachO MediaAccessibility MediaPlayer MediaToolbox Metal MetalKit MetalPerformanceShaders MobileCoreServices

  16. ModelIO OpenGLES SceneKit Security simd SpriteKit StoreKit Swift Standard Library

    SystemConfiguration UIKit
  17. WEBKIT

  18. MULTIPEERCONNE CTIVITY

  19. PORTING EXISTING APPS

  20. COCOAPODS ▸ Supports tvOS since 0.39.0 ▸ New platform: platform

    :tvos, '9.0'
  21. PODS SUPPORTING TVOS ["AFNetworking","Alamofire","CocoaLumberjack","SwiftyJSON","Charts", "Quick","Bolts","SnapKit","RxBlocking","RxCocoa","RxSwift","Nimble", "Argo","UICKeyChainStore","AsyncSwift","DTFoundation","Sync", "KeychainAccess","upnpx","AlamofireImage"] If you are

    adventurous ! https://github.com/orta/cocoapods-expert-difficulty
  22. SPRITEKIT EXAMPLE

  23. DOOM CLASSIC ▸ UIKit changes (UIAlertView, UISlider) ▸ AudioSession isn't

    available ▸ Newer C++ compiler
  24. NIBS ! If you feel like copy-pasting stuff between NIBs

    ! https://github.com/neonichu/DOOM-IOS2/tree/tvos
  25. STORAGE LIMITATIONS ▸ app is limited to 200 MB ▸

    500 KB of persistent storage (NSUserDefaults) ▸ Use iCloud ▸ Use On-Demand resources
  26. NO DIRECT MANIPULATION

  27. FOCUS ENGINE UIButton().canBecomeFocused() // == true or false UIButton().focused //

    == true or false UIScreen.mainScreen().focusedView // nil or the view in focus
  28. REACTING TO FOCUS CHANGES func didUpdateFocusInContext(context: UIFocusUpdateContext, withAnimationCoordinator coordinator: UIFocusAnimationCoordinator)

    context.nextFocusedView // the view which gets the focus context.previouslyFocusedView // the view which had the focus func addCoordinatedAnimations(_ animations: (() -> Void)?, completion completion: (() -> Void)?)
  29. DEMO

  30. SIRI?

  31. GAME CONTROLLERS

  32. None
  33. NSNotificationCenter.defaultCenter().addObserverForName(GCControllerDidConnectNotification, object: nil, queue: nil) { (note) in if let

    controller = note.object as? GCController { if let microPad = controller.microGamepad { microPad.dpad.valueChangedHandler = { (_, x, y) in if let paddle = self.childNodeWithName("Paddle") { paddle.position.y += CGFloat(y) } } } } }
  34. GAME CONTROLLERS WORK WITH UIKIT COMPONENTS

  35. SIRI REMOTE IS ALSO A GAME CONTROLLER ▸ Profile GCMicroGamepad

    ▸ Touch surface is a dpad ▸ Two action buttons ▸ Motion (GCMotion) ▸ Seems not to work in the simulator
  36. 2.27 If your app’s core functionality doesn’t work with the

    Siri remote it will be rejected. The app may, however, provide enhanced functionality in connection with a game controller or other peripheral
  37. A maximum of two game controllers (plus one remote) can

    be connected to an Apple TV at any given time.
  38. DEMO

  39. TVML

  40. APP REVIEW !

  41. CONCLUSION ▸ tvOS works very well ▸ If you know

    UIKit, it's easy to start ▸ Think about interaction
  42. RESOURCES ▸ https://developer.apple.com/tvos/human-interface-guidelines/ ▸ "Ich glotz TV", @avbelow, Macoun 2015

    ▸ https://github.com/contentful/tvful ▸ http://nerds.airbnb.com/tvos-focus-engine/ ▸ https://eternalstorms.wordpress.com/2015/10/05/pair-the-apple- tv-developer-kit-siri-remote-with-xcodes-simulator/
  43. THANKS!

  44. @NeoNacho boris@contentful.com http://buegling.com/talks