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
Homekit on tvOS
Search
Shingo Tamaki
June 05, 2017
Technology
0
1.3k
Homekit on tvOS
HomeKit frameworkを使ったtvOSアプリ開発を通して学んだ事を簡単にまとめました。
Shingo Tamaki
June 05, 2017
Tweet
Share
More Decks by Shingo Tamaki
See All by Shingo Tamaki
沖縄モバイルアプリ開発勉強会#1
tamaki
0
90
iOSアプリ開発を始めよう
tamaki
0
140
詳解xcresult.pdf
tamaki
0
310
メルペイでのリグレッションテスト自動化推進のこれまでとこれから
tamaki
0
690
What do you want to test with UI Test v2
tamaki
2
860
JPQRによって変わる日本のQRコード決済
tamaki
0
250
What's New in Testing
tamaki
1
58
What do you want to test with UI Test
tamaki
5
1.8k
How to control state in UI Test
tamaki
4
2.6k
Other Decks in Technology
See All in Technology
pg_bigmをRustで実装する(第50回PostgreSQLアンカンファレンス@オンライン 発表資料)
shinyakato_
0
150
20241228 - 成為最強魔法使!AI 實時生成比賽的策略 @ 2024 SD AI 年會
dpys
0
330
30分でわかるデータ分析者のためのディメンショナルモデリング #datatechjp / 20250120
kazaneya
PRO
12
3.4k
The key to VCP-VCF
mirie_sd
0
150
TSKaigi 2024 の登壇から広がったコミュニティ活動について
tsukuha
0
180
サイバー攻撃を想定したセキュリティガイドライン 策定とASM及びCNAPPの活用方法
syoshie
3
1.7k
React Routerで実現する型安全なSPAルーティング
sansantech
PRO
3
710
20240513 - 框裡框外_文學院學生如何在AI世代安身立命 @ 淡江大學
dpys
0
600
事業貢献を考えるための技術改善の目標設計と改善実績 / Targeted design of technical improvements to consider business contribution and improvement performance
oomatomo
0
250
OPENLOGI Company Profile for engineer
hr01
1
17k
怖くない!ゼロから始めるPHPソースコードコンパイル入門
colopl
0
230
大規模言語モデルとそのソフトウェア開発に向けた応用 (2024年版)
kazato
2
420
Featured
See All Featured
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.4k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
18
2.3k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
3
330
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
How to train your dragon (web standard)
notwaldorf
88
5.8k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
3
220
Designing for Performance
lara
604
68k
Why Our Code Smells
bkeepers
PRO
335
57k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
7
540
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
Transcript
HomeKit on tvOS
ࣗݾհ
ࣗݾհ ۄ৴ޛ iOS Engineer! tvOSΞϓϦͷ։ൃࠓ͜ͷͷͨΊʹษڧ͠·ͨ͠ɻ झຯ" ిࢠ࡞⚡ ےτϨ$ ΨδΣοτ%
tvOSΞϓϦͷ։ൃํ๏ʹ͍ͭͯ • ΫϥΠΞϯτ/αʔόܕͷΞϓϦέʔγϣϯ (TVML Kit)
tvOSΞϓϦͷ։ൃํ๏ʹ͍ͭͯ • ωΠςΟϒ։ൃ
OrigamiͷtvOSΞϓϦ ΫϥΠΞϯτ/αʔόܕͰߏங͓ͯ͠ΓɺOrigamiͷECͷӾ ཡػೳΛఏڙ͍ͯ͠·͢ɻ
OrigamiͷtvOSΞϓϦ • TVMLͷTemplate͕ECͷίϯςϯπͱϚονͨ͠ • ϥΠϒΞοϓσʔτՄೳͰϦϦʔεͷख͕ؒগͳ͍ • ৽͍͠ϓϥοτϑΥʔϜͷνϟϨϯδ
ͰࠓωΠςΟϒ࣮ ʹؔ࿈ͨ͠Λ͠·͢ ! ͖ͳࣄ͍͍ͯͬͯ͠ݴΘΕͨ͠
ૣtvOSͷΛ ͢Δલʹ...
࠷ۙͷεϚʔτϗʔϜؔ࿈ͷ Alexa
࠷ۙͷεϚʔτϗʔϜؔ࿈ͷ Google Home
࠷ۙͷεϚʔτϗʔϜؔ࿈ͷ SiriεϐʔΧʔʁ
ͳͥ͜ͷΛ͔ͨ͠ͱ ͍͏ͱʁ
HomeKit
HomeKitͱʁ Apple͕ఏڙ͢ΔεϚʔτϗʔϜͷͨΊͷϑϨʔϜϫʔΫɺ HomeKitରԠΛൢച͢ΔʹMFiೝূ͕ඞཁ
AppleTVͷHomeKitʹ͓͚Δׂ • Remote Gateway ϦϞʔτίϯτϩʔϧɺΦʔτϝʔγϣϯ͕ՄೳՄೳ
iOS10 HomeΞϓϦ͕ొ
tvOSʁ
tvOS10 HomeKitରԠ
tvOS10ͷHomeKitରԠͰԿ͕ग़དྷΔ ͷ͔ʁ • HomeKit frameworkͷҰ෦ػೳ͕Մೳʹͳͬͨ • HomeΞϓϦtvOSʹଘࡏ͠ͳ͍
ͳͷͰHomeΞϓϦͲ ͖Λࢼ࡞ग़དྷͳ͍͔ͬ ͯΈͨ
DEMO
tvOSΞϓϦ։ൃͷಛ • ը໘αΠζ • ੍ݶ͞ΕͨετϨʔδ • ύϥϥοΫεΞΠίϯ • ϑΥʔΧε
tvOSΞϓϦ։ൃͷಛ • ը໘αΠζ • ੍ݶ͞ΕͨετϨʔδ • ύϥϥοΫεΞΠίϯ • ϑΥʔΧε ←
!
ϑΥʔΧεΤϯδϯ
tvOSΞϓϦͷ։ൃʹ͍ͭͯ ϑΥʔΧεͱ͍͏֓೦tvOSʹ͔͠ͳ͍ͷͰɺ tvOSΞϓϦ։ൃͷ࠷େͷצॴͰͳ͍͔ͱࢥ͍ͬͯ·͢ɻ αϯϓϧίʔυΛ࡞ͨ࣌͠ʹࢥ͍௨Γʹಈ͔ͳ͔ͬͨέʔε ͱɺͦͷରԠʹ͍ͭͯઆ໌͠·͢ɻ ※ ϫʔΫΞϥϯυͳײ͢͡ΔͷͰͬͱςΫχΧϧͳํ๏ ͕͋Ε୭͔͋ͱͰڭ͍͑ͯͩ͘͞ɻ
ͦͷ1
ࢥ͍௨ΓʹϑΥʔΧεग़དྷͳ͍ ͦͷ1
ࢥ͍௨ΓʹϑΥʔΧεग़དྷͳ͍ ͦͷ1
ࢥ͍௨ΓʹϑΥʔΧεग़དྷͳ͍ ͦͷ1 λϒόʔ͔ΒӈଆͷηϧͷϑΥʔΧεΛېࢭ͢Δ override func shouldUpdateFocus(in context: UIFocusUpdateContext) -> Bool
{ if let prev = context.previouslyFocusedView, String(describing:type(of: prev)) == "UITabBarButton" { return false } return true }
ͦͷ2
ࢥ͍௨ΓʹϑΥʔΧεग़དྷͳ͍ ͦͷ2
ࢥ͍௨ΓʹϑΥʔΧεग़དྷͳ͍ ͦͷ2
UIFocusEnvironment Protocol UIFocusEnvironment ProtocolͷσϦήʔτϝιουͰϑΥʔΧ εΛ͏·͘ίϯτϩʔϧग़དྷΔΑ͏ʹ ࣮͢Δඞཁ͕͋Δɻ var preferredFocusEnvironments: [UIFocusEnvironment] func
shouldUpdateFocus(in context: UIFocusUpdateContext) -> Bool { return ఆॲཧ݁Ռ } override func didUpdateFocus(in context: UIFocusUpdateContext, with coordinator: UIFocusAnimationCoordinator) { //ϑΥʔΧε࣌ʹߦ͍͍ͨॲཧ } https://developer.apple.com/reference/uikit/ uifocusenvironment
Debug Quick Look
Debug _whyIsThisViewNotFocusable σόοά࣌ʹ_whyIsThisViewNotFocusableϝιουΛݺͿ͜ ͱͰݪҼͱߟ͑ΒΕΔࣄ߲Λग़ྗͯ͘͠Ε·͢ɻ
Θ͔ͬͨࣄ શͯͷϝιου͕͑ΔΘ͚Ͱͳ͍ addHome(withName homeName: String, completionHandler completion: @escaping (HMHome?, Error?)
-> Void) removeHome(_ home: HMHome, completionHandler completion: @escaping (Error?) -> Void) updatePrimaryHome(HMHome, completionHandler: (Error?) -> Void) Homeͷ࡞ʹݶΒͣɺRoomΞΫηαϦʹ͍ͭͯಉ༷
Θ͔ͬͨࣄ શͯͷϝιου͕͑ΔΘ͚Ͱͳ͍ • ߟ • TVجຊతʹݟΔ͚ͩͰɺૢ࡞͠ͳ͍ࣄ͕ଟ͍(ϦϞί ϯͷૢ࡞ͩΔ͍...)ͨΊɺͦͷػೳ͕আ֎͞Ε͍ͯΔͷͰ !
͓·͚
͋ͳ͕ͨtvOSΞϓϦ ͷ։ൃΛ͢ΔͷͳΒ ग़ઌͰͷ࣮ػσόοάͭΒ͍
͋ͳ͕ͨtvOSΞϓϦͷ։ൃΛ͢Δͷͳ Β
͋ͳ͕ͨtvOSΞϓϦͷ։ൃΛ͢Δͷͳ Β • ࣮ػ(AppleTV)ܞଳੑʹ͍͠ͷͰɺHomeKitͷૢ࡞෦ ͷ։ൃiPhoneͰߦ͑ΔΑ͏ʹͯͨ͠ํ͕ग़ઌͰ։ൃ͠ ͍͢ɻ
γϛϡϨʔλͰྑ͍ͷͰ ʁ!
HomeKitͷDBڞ༗ʹ͍ͭͯ HomeKitͷiCloudʹΑΔDBڞ༗ γϛϡϨʔλͰग़དྷͳ͍
͓Θ͔Γ͍͚ͨͩͨͩΖ ͏͔!?
࣮ػ։ൃΛڧ͍ΒΕΔཧ༝ • HomeKit DBڞ༗࣮ػ͚ͩ • HomeKit FrameworkͰHome/Room/AccesoryͳͲͷ৽ن ొɾআɾฤू͕ग़དྷͳ͍ • ඞવతʹσʔλiCloudܦ༝ͷHomeKit
DBڞ༗པΈͱͳ Δ
Enjoy tvOS App Development
ࢀߟจݙ tvOSΞϓϦέʔγϣϯϓϩάϥϛϯάΨΠυ https://developer.apple.com/jp/documentation/General/ Conceptual/AppleTV_PG/ 2017ͦ͜tvOSΞϓϦ։ൃΛ࢝Ί͍ͨΤϯδχΞ͚ɺUI࣮ ϊϋू https://techblog.yahoo.co.jp/advent-calendar-2016/tvosapp- tips/
ࢀߟจݙ Apple TV – tvOSೖ – https://developers.cyberagent.co.jp/blog/archives/3642/ UIKitCatalogͷαϯϓϧίʔυ͔ΒtvOSͷϑΥʔΧεΛֶͿ http://qiita.com/hanawat/items/a2542df65e0534979cb0 ϚωʔϑΥϫʔυͷtvOSΞϓϦέʔγϣϯΛ։ൃͨ͠
https://moneyforward.com/engineers_blog/2016/02/26/ moneyforward-tvos/
Ҏ্