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
320
メルペイでのリグレッションテスト自動化推進のこれまでとこれから
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
機械学習を「社会実装」するということ 2025年版 / Social Implementation of Machine Learning 2025 Version
moepy_stats
5
1.1k
【Oracle Cloud ウェビナー】2025年のセキュリティ脅威を読み解く:リスクに備えるためのレジリエンスとデータ保護
oracle4engineer
PRO
1
100
Visual StudioとかIDE関連小ネタ話
kosmosebi
1
370
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
6
54k
re:Invent 2024のふりかえり
beli68
0
110
When Windows Meets Kubernetes…
pichuang
0
300
2025年のARグラスの潮流
kotauchisunsun
0
790
【JAWS-UG大阪 reInvent reCap LT大会 サンバが始まったら強制終了】“1分”で初めてのソロ参戦reInventを数字で振り返りながら反省する
ttelltte
0
140
I could be Wrong!! - Learning from Agile Experts
kawaguti
PRO
8
3.4k
信頼されるためにやったこと、 やらなかったこと。/What we did to be trusted, What we did not do.
bitkey
PRO
0
2.2k
駆け出しリーダーとしての第一歩〜開発チームとの新しい関わり方〜 / Beginning Journey as Team Leader
kaonavi
0
120
Accessibility Inspectorを活用した アプリのアクセシビリティ向上方法
hinakko
0
180
Featured
See All Featured
What's in a price? How to price your products and services
michaelherold
244
12k
Designing for humans not robots
tammielis
250
25k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
870
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
160
15k
Gamification - CAS2011
davidbonilla
80
5.1k
Writing Fast Ruby
sferik
628
61k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.6k
A Philosophy of Restraint
colly
203
16k
Designing Experiences People Love
moore
139
23k
The Language of Interfaces
destraynor
155
24k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
BBQ
matthewcrist
85
9.4k
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/
Ҏ্