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
88
iOSアプリ開発を始めよう
tamaki
0
130
詳解xcresult.pdf
tamaki
0
310
メルペイでのリグレッションテスト自動化推進のこれまでとこれから
tamaki
0
690
What do you want to test with UI Test v2
tamaki
2
850
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
祝!Iceberg祭開幕!re:Invent 2024データレイク関連アップデート10分総ざらい
kniino
3
280
Opcodeを読んでいたら何故かphp-srcを読んでいた話
murashotaro
0
250
5分でわかるDuckDB
chanyou0311
10
3.2k
サーバレスアプリ開発者向けアップデートをキャッチアップしてきた #AWSreInvent #regrowth_fuk
drumnistnakano
0
190
株式会社ログラス − エンジニア向け会社説明資料 / Loglass Comapany Deck for Engineer
loglass2019
3
32k
成果を出しながら成長する、アウトプット駆動のキャッチアップ術 / Output-driven catch-up techniques to grow while producing results
aiandrox
0
320
ずっと昔に Star をつけたはずの思い出せない GitHub リポジトリを見つけたい!
rokuosan
0
150
podman_update_2024-12
orimanabu
1
270
フロントエンド設計にモブ設計を導入してみた / 20241212_cloudsign_TechFrontMeetup
bengo4com
0
1.9k
あの日俺達が夢見たサーバレスアーキテクチャ/the-serverless-architecture-we-dreamed-of
tomoki10
0
460
ブラックフライデーで購入したPixel9で、Gemini Nanoを動かしてみた
marchin1989
1
540
10分で学ぶKubernetesコンテナセキュリティ/10min-k8s-container-sec
mochizuki875
3
340
Featured
See All Featured
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.6k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Rails Girls Zürich Keynote
gr2m
94
13k
It's Worth the Effort
3n
183
28k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
0
98
Docker and Python
trallard
42
3.1k
Navigating Team Friction
lara
183
15k
Designing Experiences People Love
moore
138
23k
A Philosophy of Restraint
colly
203
16k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
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/
Ҏ্