Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Gunosy for Apple Watchができるまで

Gunosy for Apple Watchができるまで

GunosyのGlance画面を作るために作ったライブラリ
https://github.com/jeffsuke/GlanceWordRainbowImage

Bff092f77c1870ed4fba5238874776c9?s=128

Yusuke Kawanabe

May 27, 2015
Tweet

Transcript

  1. Gunosy for Apple Watch ͕Ͱ͖Δ·Ͱ גࣜձࣾGunosyɹ։ൃຊ෦ ઒ᬒ༤հ

  2. @jeffsuke iOS App Developer https://github.com/jeffsuke ࠓ೥ͷWWDC͸ ҆શͳ஍Ҭʹധ·Εͦ͏Ͱ͢

  3. WWDC2014ʹ͓͚Δ@jeffsuke॓ധઌ෇ۙ

  4. SFةݥͳ஍ҬϚοϓ ֎຿লϗʔϜϖʔδΑΓ

  5. Gunosy • ৘ใΩϡϨʔγϣϯαʔϏε • 900ສμ΢ϯϩʔυ • ࣾһͷඪ४ݴޠ͸GoΒ͍͠

  6. ֓ཁ • Apple Watch্ͰշదͳମݧΛ࣮ݱ͢Δ·Ͱؤ ுͬͨ࿩

  7. ໨࣍ • Apple WatchΞϓϦ֓ཁ • Watch Appͷ࠷దԽ • Glanceͷ࠷దԽ •

    ਃ੥ޙͷ࿩
  8. Gunosy for Apple WatchͰग़དྷΔ͜ͱ Glance Watch app

  9. Apple WatchΞϓϦ ΞϓϦຊମ Extension Watch app Storyboard Image assets Controller,

    Model Setter UIEvent
  10. Apple WatchΞϓϦͷ࢓૊Έ • ՄೳͳݶΓը૾͸Apple Watchଆʹอଘ͓ͯ͘͠ • ද͍ࣔͯ͠Δviewͷ৘ใ͸औಘग़དྷͳ͍

  11. Watch Appʹ͓͚Δ࠷దԽ

  12. Gunosyʹ͓͚ΔWatch App • Alamofire • SwiftyJSON • API͔Βड͚औͬͨ࿩୊ͷ৘ใΛݩʹ هࣄΛදࣔɻৄࡉϖʔδͰ͸ɺຊମʹ อଘɺຊମͰ։͘ࣄ͕Ͱ͖Δɻ

    • ඳը·ͰΛ࠷୹ʹ͢Δ • iPhoneͱAppleWatchͷ௨৴ΛݮΒ͢ • อଘग़དྷΔ΋ͷ͸อଘ͢Δ ϙΠϯτ ֓ཁ
  13. willActivate()ͷ׆༻ • initͱawakeͰͷॲཧΛ࠷খݶʹ 1. Watch App͕ݺͼग़͞ΕΔ 2. Storyboard͕ಡΈࠐ·ΕΔ 3. ର৅ը໘ͷinit,

    awake͕૸Δ 4. Watch্Ͱը໘͕දࣔ͞ΕΔ 5. willActivate()͕ݺ͹ΕΔ ىಈ·Ͱͷखॱ
  14. willActivate()ͷ׆༻

  15. WKInterfaceGroupͷར༻ • Placeholderͱͯ͠ • ؙ֯

  16. addCachedImage • BLEͷҝ௨৴଎౓ʹ੍ݶ͕͋ΔɻՄೳͳݶΓ࠶ར༻͢Δը૾͸ Ωϟογϡ • ֤ΞϓϦ5MB·ͰΩϟογϡՄೳ • kiavashfaisali/KFSwiftImageLoaderͱ͔࢖͏ͱศརͬΆ͍ ࢀߟɿ https://developer.apple.com/library/ios/documentation/General/Conceptual/WatchKitProgrammingGuide/Images.html

    http://qiita.com/_tid_/items/55667b00ce158a28428a
  17. addCachedImage ಡΈࠐΈ อଘ

  18. Watch Appʹ͓͚Δ࠷దԽ • ϥΠϑαΠΫϧΛ஌ΓඳըՄೳͳ෺͔Βॱ࣍ඳը ͢Δ • ը૾͸ՄೳͳݶΓWatchຊମʹ

  19. Glanceʹ͓͚Δ࠷దԽ

  20. Gunosyʹ͓͚ΔGlance • API͔Βड͚औͬͨ࿩୊ͷ৘ใΛݩʹ ը૾Λදࣔɻ࣌ܭ̍ը໘Ͱχϡʔε͕ ෼͔Δମݧɻ • ਓʹݟͤͯࣗຫͨ͘͠ͳΔػೳ Glance • ಡΈࠐΈ·Ͱͷ͕࣌ؒϙΠϯτ

    • ͻͱ໨Ͱ෼͔ΔUI ϙΠϯτ ֓ཁ
  21. ՄೳͳݶΓΩϟογϡ͢Δ • ڞ௨ͷAppGroupΛઃఆ͠ɺNSUserDefault ͰඞཁͳσʔλΛڞ༗ͨ͠ɻ • [[NSUserDefaults alloc] initWithSuiteName:@“group.mycompany.my app"] App

    Group ը૾Ωϟογϡ • addCachedImage
  22. ຊମͰը૾Λੜ੒͢Δ

  23. ຊମͰը૾Λੜ੒͢Δ

  24. GithubͰެ։͍ͯ͠·͢ • https://github.com/jeffsuke/GlanceWordRainbowImage

  25. Glanceʹ͓͚Δ࠷దԽ • ը૾ʹඳը͢Δ͜ͱͰෳࡶͳදݱΛ࣮ݱ • ՄೳͳݶΓը૾౳ΛΩϟογϡ͓ͯ͘͠

  26. ਃ੥ޙͷ࿩

  27. ϦδΣΫτͷ࿩ • ൃച೔Ͱ͋Δ4/24Λ໨ࢦͯ͠։ൃ • ͔͠͠ೋ౓ͷϦδΣΫτ • ೋͷమΛ౿·ͳ͍Tips

  28. ϦδΣΫτࣄྫ̍ • Watch appΛ࢖͏લʹҰ౓iPhoneͷ ىಈΛཁٻ͠ɺϦδΣΫτɻ • ΢Υον୯ମͰҙຯͷ͋ΔػೳΛఏ ڙͰ͖͍ͯͳ͍ҝɺຊମΞϓϦͰೝ ূΛ࣮ߦ͢Δ͜ͱʹɻ •

    ͨͩ͠ɺJAL΍Uber౳ϩάΠϯΛཁ ٻ͢ΔΞϓϦ΋ଘࡏ͢ΔͷͰɺϩά ΠϯͳΒ͹ྑ͍ͷ͔΋ɻ
  29. ϦδΣΫτࣄྫ̎ • iPhoneͰಡΉϘλϯΛԡͯ͠΋ WatchΞϓϦͰͷมԽ͕ͳ͍ͨΊϦ δΣΫτɻ • openParentApplication:reply:Λ༻͍ ͯ։͍͔ͨͲ͏͔Λฦ͢ มߋલ มߋޙ

  30. ϦδΣΫτࣄྫ̎ Watchଆ ຊମଆ

  31. ϦδΣΫτͷ࿩·ͱΊ • Apple Watch୯ମͰମݧ͕੒Γཱ͍ͬͯΔඞཁ͕ ͋Δ

  32. Apple Watch·ͱΊ • Apple WatchΞϓϦόΠφϦʹՄೳͳݶΓViewؔ ࿈ͷཁૉΛؚΊ͓ͯ͘ • ෳࡶͳॲཧ͸Extensionɺ͕͔͔࣌ؒΔॲཧ͸ຊ ମΞϓϦͰ࣮ࢪ •

    WatchΞϓϦ୯ମͰମݧΛಧ͚Δඞཁ͕͋Δ
  33. ࣭ٙԠ౴