SlideShare ist ein Scribd-Unternehmen logo
1 von 32
Downloaden Sie, um offline zu lesen
Evan Maloney Distinguished Engineer, Gilt Groupe
tvOS,
the Focus Engine
& Swift
Discoveries from building “Gilt on TV”
Demoing “Gilt on TV”
tvOS vs. iOS: Similarities
• Most of tvOS is a direct subset of iOS
• Familiarity with UIKit will serve you well with tvOS
• But, some of the things you may expect won’t be there
• No web views
• Certain frameworks like MultipeerConnectivity aren’t
available
• Several UIControls (pickers, steppers, sliders, etc.)
• Can use Interface Builder (or not), Swift or Objective-C
tvOS tvOS vs. iOS
tvOS vs. iOS: Differences
• User interaction is indirect touch
• Unlike an iPhone or iPad, the user doesn’t directly
manipulate the UI — uses indirect touch like a trackpad
• Directionality is reversed from iOS
• Relies on the Focus Engine for determining UI state
• Only on tvOS — adds extensions to UIViewController,
UIView, UITableView, UICollectionView, etc.
tvOS tvOS vs. iOS
Focus Engine Philosophy
• The Focus Engine is intended to be a black box
• You provide inputs that determine the initially focused view
• You define where the user can go
• Provide some visual indication of focusability
• Provide an animation or visual state change upon
becoming focused (often handled by the tvOS SDK)
• Once your view controller is onscreen and the initial view has
become focused, the user should be in control of all state
changes
• It is considered rude to forcibly change focus on the user
tvOS The Focus Engine
What is “Focus”?
• A focusable view is one that the user can select with the touch
remote
• Being focusable implies that the user can perform an action on
the view
• Focusable views are often “pressable,” like UIButtons
• A focused view renders itself to stand out from the others
onscreen, usually with one or more of the following attributes:
• A larger size
• A drop shadow
• A highlight color or border
tvOS Focus
How does the Focus Engine work?
• When the view hierarchy changes, the Focus Engine creates a
map of the visible focusable views
• If the user navigates in a given direction, the Focus Engine
looks for a focusable view in that direction, taking into account
each candidate view’s focus frame size & relative position
• A candidate for receiving next focus is selected
• If the candidate is a table or collection cell, the relevant
delegate is given an opportunity to reject focus and another
candidate may be selected
tvOS The Focus Engine
tvOS The Focus Engine
Gilt on TV 1.0 — Women’s Store
tvOS The Focus Engine
Focus Frames
How does a view become “Focusable”?
• By default, the following views are focusable:
• UIControls
• Table cells and collection cells
• Can be overridden by UICollectionViewDelegate
• UIViews that are not otherwise focusable can be made so by
overriding canBecomeFocused()
• The focused property of a UIView indicates whether the
view is currently in focus
tvOS Focus
How does a view become “Focused”?
• When a view controller is displayed, the focus engine asks for
the preferredFocusedView from the relevant views and
view controllers to determine which view gets initial focus
• From there, the user controls focus using the remote
• When the user swipes in a given direction, the Focus Engine
selects an appropriate focusable view to get next focus
• Developers can use the UIFocusUpdateContext to
coordinate animations when views go into and out of focus
tvOS Focus
tvOS The Focus Engine
Gilt on TV 1.0 — Men’s Store (scrolled)
tvOS The Focus Engine
Focus Frames
tvOS The Focus Engine
Changing Focus — Unambiguous Move
tvOS The Focus Engine
Ambiguous Move — Focus Engine Chooses
tvOS The Focus Engine
Sale View
tvOS The Focus Engine
Focus Frames
tvOS The Focus Engine
Navigating to “Buy Now” — A Near Miss
The Dilemma
tvOS Focus Guides
How could you solve it?
You can’t assume the Focus Engine “sees” focusable views that
aren’t in the direct path of the swipe direction
tvOS solution
Allow a UIView to report to a focus frame that’s larger than the
view’s native frame
1. Call parentView.addLayoutGuide(UIFocusGuide)
2. Set the focus guide’s preferredFocusedView
3. Add Auto Layout constraints using the focus guide as you
would any UIView
tvOS Focus Guides
A focus guide defines a screen rectangle
tvOS Focus Guides
Focus is forwarded to the preferredFocusedView
tvOS Focus Guides
Allowing a small button to respond to a large frame
Handling scrolling content
• You will not be able to present scrolling content in the same
way you do in iOS
• User can only scroll by navigating to something focusable
within a scroll view
• The Focus Engine only pays attention to focusable non-hidden
views with non-zero alphas that have at least one pixel within
the screen bounds
• Focusable views and cells that are offscreen won’t be visible
to the Focus Engine, so the user can’t navigate to them
tvOS The Focus Engine
tvOS Focus Guides
Product View
tvOS Focus Guides
Focus Frames
Other challenges for tvOS developers
• Apparently a lot of people rely on web views for mission-critical
screens within their apps — they will be forced to rethink
• Restrictions on App Store binaries:
• Applications need to be submitted as Bitcode binaries
• This includes embedded frameworks, which makes many
third-party closed-source frameworks unusable in tvOS
• On-device testing — Very few people have development
devices, and simulator testing may not reveal all problems
tvOS tvOS Development
Fun things about tvOS development
• Some of the iOS pain points don’t exist on tvOS
• Apple TVs will often be used to stream video — unlike with
mobile devices, tvOS developers can assume the presence
of low-latency, always-on, high-bandwidth networks
• Don’t need to think about screen rotation or size class
changes
• Only need to develop for a single screen resolution — for
now
tvOS tvOS Development
A few words about Swift
and finally…
Swift — Pain Points
• The language is still changing, so major releases of Xcode
often require a bit of code rewriting
• Usually minimal, and the language is improving as a result
• Developer tooling still needs work
• Debugger sometimes refuses to cough up variable values
• Compiler errors can be vague or misleading
• Compiler stability is sometimes an issue
• Heavy use of Swift frameworks sometimes doesn’t play
nicely with “whole module optimization”
• Binaries may not be compatible across compiler versions
tvOS Swift
Swift — Advantages
• Swift may not be mature, but it is ready for prime-time
• Swift absolutely fulfills the promise of more efficient
development
• An entire class of errors that used to require runtime
debugging is now caught by the compiler
• Building a stable app takes much less work than Objective-C
• I probably spent about ¼ the time debugging as I would
have had to do in ObjC
• Coding in Swift is an absolute pleasure
tvOS Swift
Swift — The Verdict
tvOS Swift
Do it!
You know you’ll “go Swift” eventually…
…and the longer you wait, the more you’ll be kicking yourself
for not having done it sooner once you finally do!
Evan Maloney Distinguished Engineer, Gilt Groupe
A parting gift for you
https://github.com/emaloney/CleanroomLogger
CleanroomLogger — A pure Swift logging engine
Simple, lightweight & performant
Code goodies!

Weitere ähnliche Inhalte

Was ist angesagt?

47417812 manual-del-constructor-cemex
47417812 manual-del-constructor-cemex47417812 manual-del-constructor-cemex
47417812 manual-del-constructor-cemexFlavio Alberto
 
Clasificación de los Cerámicos
Clasificación de los CerámicosClasificación de los Cerámicos
Clasificación de los CerámicosLorena Carina
 
38913252-Diseno-Sismo-Resistente-en-Acero.pdf
38913252-Diseno-Sismo-Resistente-en-Acero.pdf38913252-Diseno-Sismo-Resistente-en-Acero.pdf
38913252-Diseno-Sismo-Resistente-en-Acero.pdfJuanZamora593493
 
Aplanados finos, rusticos y repellado
Aplanados finos, rusticos y repelladoAplanados finos, rusticos y repellado
Aplanados finos, rusticos y repelladoCarlos Moreno
 
317641801 presentacion-naves-industriales-en-acero-alfredo-arnedo-pena
317641801 presentacion-naves-industriales-en-acero-alfredo-arnedo-pena317641801 presentacion-naves-industriales-en-acero-alfredo-arnedo-pena
317641801 presentacion-naves-industriales-en-acero-alfredo-arnedo-penaAndres Leyton
 
Cimientos piedra-braza
Cimientos piedra-brazaCimientos piedra-braza
Cimientos piedra-brazamobilcachucha
 
Edoc.site nch 165-of77-aridos-para-mortero-y-hormigones-tami
Edoc.site nch 165-of77-aridos-para-mortero-y-hormigones-tamiEdoc.site nch 165-of77-aridos-para-mortero-y-hormigones-tami
Edoc.site nch 165-of77-aridos-para-mortero-y-hormigones-tamiDr. Hugo Valdes Riquelme
 
PLANOS ESTRUCTURALES
PLANOS ESTRUCTURALESPLANOS ESTRUCTURALES
PLANOS ESTRUCTURALESKaren Sol
 
Reporte de práctica granulometría
Reporte de práctica granulometríaReporte de práctica granulometría
Reporte de práctica granulometríaAmore Penagos
 
Dosificacionodiseodemezclasdelconcreto 111121192729-phpapp01
Dosificacionodiseodemezclasdelconcreto 111121192729-phpapp01Dosificacionodiseodemezclasdelconcreto 111121192729-phpapp01
Dosificacionodiseodemezclasdelconcreto 111121192729-phpapp01Oscar Barreto
 
1c. Concreto Hidraulico (Proporcionamiento) Blanco Y Negro
1c.   Concreto Hidraulico (Proporcionamiento) Blanco Y Negro1c.   Concreto Hidraulico (Proporcionamiento) Blanco Y Negro
1c. Concreto Hidraulico (Proporcionamiento) Blanco Y NegroBenjamin
 
Ensayo a compresión paralela a la madera
Ensayo a compresión paralela a la maderaEnsayo a compresión paralela a la madera
Ensayo a compresión paralela a la maderaDario Vasquez
 
Dosificación de materiales para mezcla de concreto (hormigón) - Axel Martínez...
Dosificación de materiales para mezcla de concreto (hormigón) - Axel Martínez...Dosificación de materiales para mezcla de concreto (hormigón) - Axel Martínez...
Dosificación de materiales para mezcla de concreto (hormigón) - Axel Martínez...Axel Martínez Nieto
 
Módulo 2 y 3
Módulo 2 y 3Módulo 2 y 3
Módulo 2 y 3kjcampos
 

Was ist angesagt? (20)

47417812 manual-del-constructor-cemex
47417812 manual-del-constructor-cemex47417812 manual-del-constructor-cemex
47417812 manual-del-constructor-cemex
 
Clasificación de los Cerámicos
Clasificación de los CerámicosClasificación de los Cerámicos
Clasificación de los Cerámicos
 
38913252-Diseno-Sismo-Resistente-en-Acero.pdf
38913252-Diseno-Sismo-Resistente-en-Acero.pdf38913252-Diseno-Sismo-Resistente-en-Acero.pdf
38913252-Diseno-Sismo-Resistente-en-Acero.pdf
 
Especificaciones
EspecificacionesEspecificaciones
Especificaciones
 
Granulometria de los agregados
Granulometria de los agregadosGranulometria de los agregados
Granulometria de los agregados
 
Aplanados finos, rusticos y repellado
Aplanados finos, rusticos y repelladoAplanados finos, rusticos y repellado
Aplanados finos, rusticos y repellado
 
317641801 presentacion-naves-industriales-en-acero-alfredo-arnedo-pena
317641801 presentacion-naves-industriales-en-acero-alfredo-arnedo-pena317641801 presentacion-naves-industriales-en-acero-alfredo-arnedo-pena
317641801 presentacion-naves-industriales-en-acero-alfredo-arnedo-pena
 
Cimientos piedra-braza
Cimientos piedra-brazaCimientos piedra-braza
Cimientos piedra-braza
 
3 muros divisorios
3 muros divisorios3 muros divisorios
3 muros divisorios
 
Edoc.site nch 165-of77-aridos-para-mortero-y-hormigones-tami
Edoc.site nch 165-of77-aridos-para-mortero-y-hormigones-tamiEdoc.site nch 165-of77-aridos-para-mortero-y-hormigones-tami
Edoc.site nch 165-of77-aridos-para-mortero-y-hormigones-tami
 
PLANOS ESTRUCTURALES
PLANOS ESTRUCTURALESPLANOS ESTRUCTURALES
PLANOS ESTRUCTURALES
 
Reporte de práctica granulometría
Reporte de práctica granulometríaReporte de práctica granulometría
Reporte de práctica granulometría
 
Manual Losacero
Manual LosaceroManual Losacero
Manual Losacero
 
Dosificacionodiseodemezclasdelconcreto 111121192729-phpapp01
Dosificacionodiseodemezclasdelconcreto 111121192729-phpapp01Dosificacionodiseodemezclasdelconcreto 111121192729-phpapp01
Dosificacionodiseodemezclasdelconcreto 111121192729-phpapp01
 
1c. Concreto Hidraulico (Proporcionamiento) Blanco Y Negro
1c.   Concreto Hidraulico (Proporcionamiento) Blanco Y Negro1c.   Concreto Hidraulico (Proporcionamiento) Blanco Y Negro
1c. Concreto Hidraulico (Proporcionamiento) Blanco Y Negro
 
Tabique
TabiqueTabique
Tabique
 
Clase 01 ejemplo p#01 eleccion de ruta
Clase 01 ejemplo p#01 eleccion de rutaClase 01 ejemplo p#01 eleccion de ruta
Clase 01 ejemplo p#01 eleccion de ruta
 
Ensayo a compresión paralela a la madera
Ensayo a compresión paralela a la maderaEnsayo a compresión paralela a la madera
Ensayo a compresión paralela a la madera
 
Dosificación de materiales para mezcla de concreto (hormigón) - Axel Martínez...
Dosificación de materiales para mezcla de concreto (hormigón) - Axel Martínez...Dosificación de materiales para mezcla de concreto (hormigón) - Axel Martínez...
Dosificación de materiales para mezcla de concreto (hormigón) - Axel Martínez...
 
Módulo 2 y 3
Módulo 2 y 3Módulo 2 y 3
Módulo 2 y 3
 

Andere mochten auch

Dsug 05 02-15 - ScalDI - lightweight DI in Scala
Dsug 05 02-15 - ScalDI - lightweight DI in ScalaDsug 05 02-15 - ScalDI - lightweight DI in Scala
Dsug 05 02-15 - ScalDI - lightweight DI in ScalaUgo Matrangolo
 
Handling Changes to Your Server-Side Data Model
Handling Changes to Your Server-Side Data ModelHandling Changes to Your Server-Side Data Model
Handling Changes to Your Server-Side Data ModelGilt Tech Talks
 
Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"
Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"
Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"Lviv Startup Club
 
Introduction to tvOS app Development !
Introduction to tvOS app Development !Introduction to tvOS app Development !
Introduction to tvOS app Development !Snehal Patil
 
The new Apple TV and the tvOS
The new Apple TV and the tvOSThe new Apple TV and the tvOS
The new Apple TV and the tvOSMugunth Kumar
 
Building Apps for Apple TV
Building Apps for Apple TVBuilding Apps for Apple TV
Building Apps for Apple TVdavidolesch
 
Scaling micro services at gilt
Scaling micro services at giltScaling micro services at gilt
Scaling micro services at giltAdrian Trenaman
 
AbemaTV on tvOS
AbemaTV on tvOSAbemaTV on tvOS
AbemaTV on tvOSYuji Hato
 

Andere mochten auch (11)

Dsug 05 02-15 - ScalDI - lightweight DI in Scala
Dsug 05 02-15 - ScalDI - lightweight DI in ScalaDsug 05 02-15 - ScalDI - lightweight DI in Scala
Dsug 05 02-15 - ScalDI - lightweight DI in Scala
 
Handling Changes to Your Server-Side Data Model
Handling Changes to Your Server-Side Data ModelHandling Changes to Your Server-Side Data Model
Handling Changes to Your Server-Side Data Model
 
An Intro to Swift
An Intro to SwiftAn Intro to Swift
An Intro to Swift
 
Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"
Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"
Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"
 
Introduction to tvOS app Development !
Introduction to tvOS app Development !Introduction to tvOS app Development !
Introduction to tvOS app Development !
 
The new Apple TV and the tvOS
The new Apple TV and the tvOSThe new Apple TV and the tvOS
The new Apple TV and the tvOS
 
tvOS
tvOStvOS
tvOS
 
Building Apps for Apple TV
Building Apps for Apple TVBuilding Apps for Apple TV
Building Apps for Apple TV
 
Scaling micro services at gilt
Scaling micro services at giltScaling micro services at gilt
Scaling micro services at gilt
 
AbemaTV on tvOS
AbemaTV on tvOSAbemaTV on tvOS
AbemaTV on tvOS
 
Zuul @ Netflix SpringOne Platform
Zuul @ Netflix SpringOne PlatformZuul @ Netflix SpringOne Platform
Zuul @ Netflix SpringOne Platform
 

Ähnlich wie Evan Maloney on tvOS Development, the Focus Engine, and Swift

Session 16 - Designing universal interface which used for iPad and iPhone
Session 16  -  Designing universal interface which used for iPad and iPhoneSession 16  -  Designing universal interface which used for iPad and iPhone
Session 16 - Designing universal interface which used for iPad and iPhoneVu Tran Lam
 
Session 8 - Xcode 5 and interface builder for iOS 7 application
Session 8 - Xcode 5 and interface builder for iOS 7 applicationSession 8 - Xcode 5 and interface builder for iOS 7 application
Session 8 - Xcode 5 and interface builder for iOS 7 applicationVu Tran Lam
 
tvOS: An Introduction for iOS Developers
tvOS: An Introduction for iOS DeveloperstvOS: An Introduction for iOS Developers
tvOS: An Introduction for iOS DevelopersEric Hyche
 
iOS Programming 101
iOS Programming 101iOS Programming 101
iOS Programming 101rwenderlich
 
Adjusting to Auto Layout (Tutorial / Tips for iOS Auto Layout)
Adjusting to Auto Layout (Tutorial / Tips for iOS Auto Layout)Adjusting to Auto Layout (Tutorial / Tips for iOS Auto Layout)
Adjusting to Auto Layout (Tutorial / Tips for iOS Auto Layout)Derek Lee Boire
 
"WebView, the fifth element" por @fernando_cejas
"WebView, the fifth element" por @fernando_cejas"WebView, the fifth element" por @fernando_cejas
"WebView, the fifth element" por @fernando_cejaswebcat
 
Webview: The fifth element
Webview: The fifth elementWebview: The fifth element
Webview: The fifth elementFernando Cejas
 
Top 4 Cross Platform tools for Mobile App Development
Top 4 Cross Platform tools for Mobile App DevelopmentTop 4 Cross Platform tools for Mobile App Development
Top 4 Cross Platform tools for Mobile App Developmenttechugo
 
Building your first iOS app using Xamarin
Building your first iOS app using XamarinBuilding your first iOS app using Xamarin
Building your first iOS app using XamarinGill Cleeren
 
Cross Platform Mobile Application Architecture
Cross Platform Mobile Application ArchitectureCross Platform Mobile Application Architecture
Cross Platform Mobile Application ArchitectureDerrick Bowen
 
Building a better User Experience for Windows Phone Users
Building a better User Experience for Windows Phone UsersBuilding a better User Experience for Windows Phone Users
Building a better User Experience for Windows Phone UsersSandra González
 
Bringing Swift into your Objective-C Projects
Bringing Swift into your Objective-C ProjectsBringing Swift into your Objective-C Projects
Bringing Swift into your Objective-C ProjectsRené Cacheaux
 
[iPlayground] 從 0 到 1 的距離,我與 tvOS 的邂逅
[iPlayground] 從 0 到 1 的距離,我與 tvOS 的邂逅[iPlayground] 從 0 到 1 的距離,我與 tvOS 的邂逅
[iPlayground] 從 0 到 1 的距離,我與 tvOS 的邂逅Jia-Jyun Hsu
 
Responsive Web Design
Responsive Web DesignResponsive Web Design
Responsive Web DesignJulia Vi
 
Learning C# iPad Programming
Learning C# iPad ProgrammingLearning C# iPad Programming
Learning C# iPad ProgrammingRich Helton
 
Getting started with Xamarin forms
Getting started with Xamarin formsGetting started with Xamarin forms
Getting started with Xamarin formsSolTech, Inc.
 
J query mobile tech talk
J query mobile tech talkJ query mobile tech talk
J query mobile tech talkwoliverj
 
Why Do Mobile Projects Fail?
Why Do Mobile Projects Fail?Why Do Mobile Projects Fail?
Why Do Mobile Projects Fail?Indiginox
 

Ähnlich wie Evan Maloney on tvOS Development, the Focus Engine, and Swift (20)

Session 16 - Designing universal interface which used for iPad and iPhone
Session 16  -  Designing universal interface which used for iPad and iPhoneSession 16  -  Designing universal interface which used for iPad and iPhone
Session 16 - Designing universal interface which used for iPad and iPhone
 
Session 8 - Xcode 5 and interface builder for iOS 7 application
Session 8 - Xcode 5 and interface builder for iOS 7 applicationSession 8 - Xcode 5 and interface builder for iOS 7 application
Session 8 - Xcode 5 and interface builder for iOS 7 application
 
tvOS: An Introduction for iOS Developers
tvOS: An Introduction for iOS DeveloperstvOS: An Introduction for iOS Developers
tvOS: An Introduction for iOS Developers
 
iOS Programming 101
iOS Programming 101iOS Programming 101
iOS Programming 101
 
Adjusting to Auto Layout (Tutorial / Tips for iOS Auto Layout)
Adjusting to Auto Layout (Tutorial / Tips for iOS Auto Layout)Adjusting to Auto Layout (Tutorial / Tips for iOS Auto Layout)
Adjusting to Auto Layout (Tutorial / Tips for iOS Auto Layout)
 
"WebView, the fifth element" por @fernando_cejas
"WebView, the fifth element" por @fernando_cejas"WebView, the fifth element" por @fernando_cejas
"WebView, the fifth element" por @fernando_cejas
 
Webview: The fifth element
Webview: The fifth elementWebview: The fifth element
Webview: The fifth element
 
Top 4 Cross Platform tools for Mobile App Development
Top 4 Cross Platform tools for Mobile App DevelopmentTop 4 Cross Platform tools for Mobile App Development
Top 4 Cross Platform tools for Mobile App Development
 
Building your first iOS app using Xamarin
Building your first iOS app using XamarinBuilding your first iOS app using Xamarin
Building your first iOS app using Xamarin
 
Cross Platform Mobile Application Architecture
Cross Platform Mobile Application ArchitectureCross Platform Mobile Application Architecture
Cross Platform Mobile Application Architecture
 
Building a better User Experience for Windows Phone Users
Building a better User Experience for Windows Phone UsersBuilding a better User Experience for Windows Phone Users
Building a better User Experience for Windows Phone Users
 
Bringing Swift into your Objective-C Projects
Bringing Swift into your Objective-C ProjectsBringing Swift into your Objective-C Projects
Bringing Swift into your Objective-C Projects
 
[iPlayground] 從 0 到 1 的距離,我與 tvOS 的邂逅
[iPlayground] 從 0 到 1 的距離,我與 tvOS 的邂逅[iPlayground] 從 0 到 1 的距離,我與 tvOS 的邂逅
[iPlayground] 從 0 到 1 的距離,我與 tvOS 的邂逅
 
Animation in iOS
Animation in iOSAnimation in iOS
Animation in iOS
 
Responsive Web Design
Responsive Web DesignResponsive Web Design
Responsive Web Design
 
Learning C# iPad Programming
Learning C# iPad ProgrammingLearning C# iPad Programming
Learning C# iPad Programming
 
Getting started with Xamarin forms
Getting started with Xamarin formsGetting started with Xamarin forms
Getting started with Xamarin forms
 
J query mobile tech talk
J query mobile tech talkJ query mobile tech talk
J query mobile tech talk
 
Create great UIs for budget phones
Create great UIs for budget phonesCreate great UIs for budget phones
Create great UIs for budget phones
 
Why Do Mobile Projects Fail?
Why Do Mobile Projects Fail?Why Do Mobile Projects Fail?
Why Do Mobile Projects Fail?
 

Kürzlich hochgeladen

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 

Kürzlich hochgeladen (20)

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

Evan Maloney on tvOS Development, the Focus Engine, and Swift

  • 1. Evan Maloney Distinguished Engineer, Gilt Groupe tvOS, the Focus Engine & Swift Discoveries from building “Gilt on TV”
  • 3. tvOS vs. iOS: Similarities • Most of tvOS is a direct subset of iOS • Familiarity with UIKit will serve you well with tvOS • But, some of the things you may expect won’t be there • No web views • Certain frameworks like MultipeerConnectivity aren’t available • Several UIControls (pickers, steppers, sliders, etc.) • Can use Interface Builder (or not), Swift or Objective-C tvOS tvOS vs. iOS
  • 4. tvOS vs. iOS: Differences • User interaction is indirect touch • Unlike an iPhone or iPad, the user doesn’t directly manipulate the UI — uses indirect touch like a trackpad • Directionality is reversed from iOS • Relies on the Focus Engine for determining UI state • Only on tvOS — adds extensions to UIViewController, UIView, UITableView, UICollectionView, etc. tvOS tvOS vs. iOS
  • 5. Focus Engine Philosophy • The Focus Engine is intended to be a black box • You provide inputs that determine the initially focused view • You define where the user can go • Provide some visual indication of focusability • Provide an animation or visual state change upon becoming focused (often handled by the tvOS SDK) • Once your view controller is onscreen and the initial view has become focused, the user should be in control of all state changes • It is considered rude to forcibly change focus on the user tvOS The Focus Engine
  • 6. What is “Focus”? • A focusable view is one that the user can select with the touch remote • Being focusable implies that the user can perform an action on the view • Focusable views are often “pressable,” like UIButtons • A focused view renders itself to stand out from the others onscreen, usually with one or more of the following attributes: • A larger size • A drop shadow • A highlight color or border tvOS Focus
  • 7. How does the Focus Engine work? • When the view hierarchy changes, the Focus Engine creates a map of the visible focusable views • If the user navigates in a given direction, the Focus Engine looks for a focusable view in that direction, taking into account each candidate view’s focus frame size & relative position • A candidate for receiving next focus is selected • If the candidate is a table or collection cell, the relevant delegate is given an opportunity to reject focus and another candidate may be selected tvOS The Focus Engine
  • 8. tvOS The Focus Engine Gilt on TV 1.0 — Women’s Store
  • 9. tvOS The Focus Engine Focus Frames
  • 10. How does a view become “Focusable”? • By default, the following views are focusable: • UIControls • Table cells and collection cells • Can be overridden by UICollectionViewDelegate • UIViews that are not otherwise focusable can be made so by overriding canBecomeFocused() • The focused property of a UIView indicates whether the view is currently in focus tvOS Focus
  • 11. How does a view become “Focused”? • When a view controller is displayed, the focus engine asks for the preferredFocusedView from the relevant views and view controllers to determine which view gets initial focus • From there, the user controls focus using the remote • When the user swipes in a given direction, the Focus Engine selects an appropriate focusable view to get next focus • Developers can use the UIFocusUpdateContext to coordinate animations when views go into and out of focus tvOS Focus
  • 12. tvOS The Focus Engine Gilt on TV 1.0 — Men’s Store (scrolled)
  • 13. tvOS The Focus Engine Focus Frames
  • 14. tvOS The Focus Engine Changing Focus — Unambiguous Move
  • 15. tvOS The Focus Engine Ambiguous Move — Focus Engine Chooses
  • 16. tvOS The Focus Engine Sale View
  • 17. tvOS The Focus Engine Focus Frames
  • 18. tvOS The Focus Engine Navigating to “Buy Now” — A Near Miss
  • 19. The Dilemma tvOS Focus Guides How could you solve it? You can’t assume the Focus Engine “sees” focusable views that aren’t in the direct path of the swipe direction tvOS solution Allow a UIView to report to a focus frame that’s larger than the view’s native frame 1. Call parentView.addLayoutGuide(UIFocusGuide) 2. Set the focus guide’s preferredFocusedView 3. Add Auto Layout constraints using the focus guide as you would any UIView
  • 20. tvOS Focus Guides A focus guide defines a screen rectangle
  • 21. tvOS Focus Guides Focus is forwarded to the preferredFocusedView
  • 22. tvOS Focus Guides Allowing a small button to respond to a large frame
  • 23. Handling scrolling content • You will not be able to present scrolling content in the same way you do in iOS • User can only scroll by navigating to something focusable within a scroll view • The Focus Engine only pays attention to focusable non-hidden views with non-zero alphas that have at least one pixel within the screen bounds • Focusable views and cells that are offscreen won’t be visible to the Focus Engine, so the user can’t navigate to them tvOS The Focus Engine
  • 26. Other challenges for tvOS developers • Apparently a lot of people rely on web views for mission-critical screens within their apps — they will be forced to rethink • Restrictions on App Store binaries: • Applications need to be submitted as Bitcode binaries • This includes embedded frameworks, which makes many third-party closed-source frameworks unusable in tvOS • On-device testing — Very few people have development devices, and simulator testing may not reveal all problems tvOS tvOS Development
  • 27. Fun things about tvOS development • Some of the iOS pain points don’t exist on tvOS • Apple TVs will often be used to stream video — unlike with mobile devices, tvOS developers can assume the presence of low-latency, always-on, high-bandwidth networks • Don’t need to think about screen rotation or size class changes • Only need to develop for a single screen resolution — for now tvOS tvOS Development
  • 28. A few words about Swift and finally…
  • 29. Swift — Pain Points • The language is still changing, so major releases of Xcode often require a bit of code rewriting • Usually minimal, and the language is improving as a result • Developer tooling still needs work • Debugger sometimes refuses to cough up variable values • Compiler errors can be vague or misleading • Compiler stability is sometimes an issue • Heavy use of Swift frameworks sometimes doesn’t play nicely with “whole module optimization” • Binaries may not be compatible across compiler versions tvOS Swift
  • 30. Swift — Advantages • Swift may not be mature, but it is ready for prime-time • Swift absolutely fulfills the promise of more efficient development • An entire class of errors that used to require runtime debugging is now caught by the compiler • Building a stable app takes much less work than Objective-C • I probably spent about ¼ the time debugging as I would have had to do in ObjC • Coding in Swift is an absolute pleasure tvOS Swift
  • 31. Swift — The Verdict tvOS Swift Do it! You know you’ll “go Swift” eventually… …and the longer you wait, the more you’ll be kicking yourself for not having done it sooner once you finally do!
  • 32. Evan Maloney Distinguished Engineer, Gilt Groupe A parting gift for you https://github.com/emaloney/CleanroomLogger CleanroomLogger — A pure Swift logging engine Simple, lightweight & performant Code goodies!