Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
📺
Search
Boris Bügling
March 02, 2016
Programming
0
2k
📺
Introduction to tvOS development, given at try! Swift 2016 in Tokyo. 🇯🇵
Boris Bügling
March 02, 2016
Tweet
Share
More Decks by Boris Bügling
See All by Boris Bügling
Testing ⌚️ Apps and Other Extensions
neonichu
1
4.6k
Cross-platform Swift
neonichu
4
18k
Building better API clients in Swift
neonichu
1
290
Cross-platform Swift
neonichu
3
890
Swift Package Manager
neonichu
2
320
Swift Package Manager
neonichu
0
50
Cross-Platform Swift
neonichu
0
75
Swift Package Manager
neonichu
6
4.3k
Bring your apps to the big screen 📺
neonichu
1
540
Other Decks in Programming
See All in Programming
Jaspr Dart Web Framework 박제창 @Devfest 2024
itsmedreamwalker
0
150
オニオンアーキテクチャを使って、 Unityと.NETでコードを共有する
soi013
0
370
Оптимизируем производительность блока Казначейство
lamodatech
0
950
はてなにおけるfujiwara-wareの活用やecspressoのCI/CD構成 / Fujiwara Tech Conference 2025
cohalz
3
2.8k
非ブラウザランタイムとWeb標準 / Non-Browser Runtimes and Web Standards
petamoriken
0
430
サーバーゆる勉強会 DBMS の仕組み編
kj455
1
300
技術的負債と向き合うカイゼン活動を1年続けて分かった "持続可能" なプロダクト開発
yuichiro_serita
0
300
선언형 UI에서의 상태관리
l2hyunwoo
0
270
functionalなアプローチで動的要素を排除する
ryopeko
1
210
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
1.3k
Androidアプリの One Experience リリース
nein37
0
1.2k
watsonx.ai Dojo #6 継続的なAIアプリ開発と展開
oniak3ibm
PRO
0
170
Featured
See All Featured
Designing for Performance
lara
604
68k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3.1k
Facilitating Awesome Meetings
lara
51
6.2k
Thoughts on Productivity
jonyablonski
68
4.4k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.5k
Being A Developer After 40
akosma
89
590k
Become a Pro
speakerdeck
PRO
26
5.1k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
160
15k
Faster Mobile Websites
deanohume
305
30k
What's in a price? How to price your products and services
michaelherold
244
12k
Transcript
! TRY! SWIFT, MARCH 2016 BORIS BÜGLING - @NEONACHO
None
COCOAPODS
CONTENTFUL
None
“‘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.’”
OCTOBER 21, 2011
SEPTEMBER 9, 2015
None
None
The future of TV is iOS
1 1 https://twitter.com/davidolesch/status/656126103921160192
WEBKIT
MULTIPEERCONNECTIVITY
STORAGE LIMITATIONS ▸ app is limited to 200 MB ▸
500 KB of persistent storage (NSUserDefaults) ▸ Use iCloud ▸ Use On-Demand resources
PORTING EXISTING APPS
COCOAPODS ▸ Supports tvOS since 0.39.0 ▸ New platform: platform
:tvos, '9.0'
PODS NOT SUPPORTING TVOS If you are adventurous ! https://github.com/orta/cocoapods-expert-difficulty
SPRITEKIT EXAMPLE
None
DOOM CLASSIC ▸ UIKit changes (UIAlertView, UISlider) ▸ AudioSession isn't
available ▸ Newer C++ compiler
NIBS ! If you don't feel like copy-pasting stuff between
NIBs ! https://github.com/neonichu/bohne
NO DIRECT MANIPULATION
FOCUS ENGINE UIButton().canBecomeFocused() // == true or false UIButton().focused //
== true or false UIScreen.mainScreen().focusedView // nil or the view in focus
DEMO
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)?)
CUSTOMFOCUSVIEW class CustomFocusView: UIView { override func canBecomeFocused() -> Bool
{ return true } }
CUSTOMFOCUSVIEW override func didUpdateFocusInContext(context: UIFocusUpdateContext, withAnimationCoordinator coordinator: UIFocusAnimationCoordinator) { coordinator.addCoordinatedAnimations({
// ... }, completion: nil) }
CUSTOMFOCUSVIEW let duration = UIView.inheritedAnimationDuration() UIView.animateWithDuration(duration, animations: { if context.nextFocusedView
== self { self.backgroundColor = UIColor.redColor() } if context.previouslyFocusedView == self { self.backgroundColor = UIColor.whiteColor() } })
DEBUGGING FOCUS print(view.performSelector("_whyIsThisViewNotFocusable")) e.g. for a UILabel Unmanaged<AnyObject>(_value: ISSUE: This
view has userInteractionEnabled set to NO. Views must allow user interaction to be focusable. ISSUE: This view returns NO from -canBecomeFocused. )
GOOD PLACES FOR BREAKPOINTS func shouldUpdateFocusInContext(_ context: UIFocusUpdateContext) -> Bool
func didUpdateFocusInContext(_ context: UIFocusUpdateContext, withAnimationCoordinator coordinator: UIFocusAnimationCoordinator)
GESTURES AND BUTTON PRESSES let tapRecognizer = UITapGestureRecognizer(target: self, action:
"tapped:") let pressTypes = [NSNumber(integer: UIPressType.PlayPause.rawValue)] tapRecognizer.allowedPressTypes = pressTypes; self.view.addGestureRecognizer(tapRecognizer) let swipeRecognizer = UISwipeGestureRecognizer(target: self, action: "swiped:") swipeRecognizer.direction = .Right self.view.addGestureRecognizer(swipeRecognizer)
LOWER-LEVEL API: UIPress Very similar to UITouch-based API in iOS
func pressesBegan(presses: Set<UIPress>, withEvent event: UIPressesEvent?) func pressesEnded(presses: Set<UIPress>, withEvent event: UIPressesEvent?) func pressesChanged(presses: Set<UIPress>, withEvent event: UIPressesEvent?) func pressesCancelled(presses: Set<UIPress>, withEvent event: UIPressesEvent?)
TEXT INPUT
SIRI?
HANDOFF IS ALSO NOT SUPPORTED
https://github.com/rsattar/Voucher
GAME CONTROLLERS
None
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
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) } } } } }
GAME CONTROLLERS WORK WITH UIKIT COMPONENTS
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
None
A maximum of two game controllers (plus one remote) can
be connected to an Apple TV at any given time.
DEMO
TVML
CONCLUSION ▸ tvOS works very well ▸ If you know
UIKit, it's easy to start ▸ Think about interaction
RESOURCES ▸ https://developer.apple.com/tvos/human-interface-guidelines/ ▸ "Ich glotz TV", @avbelow, Macoun 2015
▸ https://speakerdeck.com/toco/intro-to-tvos ▸ 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/
THANKS!
@NeoNacho
[email protected]
http://buegling.com/talks