Apple WatchのGlanceについて

D72f33c62d4174992d1895ad1a3df9ab?s=47 haranicle
December 20, 2014

Apple WatchのGlanceについて

yidev 第17回勉強会で発表した資料です。
https://atnd.org/events/59014

D72f33c62d4174992d1895ad1a3df9ab?s=128

haranicle

December 20, 2014
Tweet

Transcript

  1. "QQMF8BUDIͷ (MBODFʹ͍ͭͯ !IBSBOJDMF

  2. ࣗݾ঺հ  !IBSBOJDMF ݪҰ࢙ ,B[VTIJ)BSB  /55ιϑτ΢ΣΞגࣜձࣾ J04 "OESPJE (SBJMTʜ

    ݸਓͰ࡞ͬͨ"QQT
  3. ͓அΓ ͜ͷࢿྉ͸"QQMFͷ Ұൠެ։ࢿྉΛ ݩʹ࡞੒͍ͯ͠·͢ EFNPҎ֎  9DPEFCFUB ࣌఺ͷ৘ใͰ͢ 9DPEF͕Ξοϓσʔτ͞Εͯ ͍Ζ͍ΖมΘͬͨΒ͝ΊΜͳ͍͞

  4. ΞδΣϯμ ✴ (MBODFͱ͸ ✴ (MBODFͷ࡞Γํ ✴ (MBODF*OUFSGBDF(VJEFMJOFT ✴ Ξχϝʔγϣϯ ✴

    Ґஔ৘ใ ✴ ͓·͚)BOEPGG 
  5. (MBODFͱ͸

  6. ]шƅ ŧŽŕ

  7. None
  8. (MBODFͱ͸ ✴ J04Ͱ͍͏௨஌ηϯλʔͷΑ͏ͳ΋ͷ ✴ ֤8BUDI"QQͷॏཁͳ৘ใΛදࣔ͢Δ6* ✴ 8BUDI"QQ͸࠷େͭͷ(MBODFΛ࣋ͭ ✴ جຊతʹૢ࡞͸Ͱ͖ͳ͍දࣔઐ༻ ✴

    8BUDI'BDF ͔Β্ʹεϫΠϓͰදࣔ ✴ (MBODFϖʔδ ը໘શମͰදࣔ  ✴ ԣεϫΠϓͰଞͷ(MBODFʹ੾Γସ͑ ✴ λοϓ͢ΔͱରԠ͢Δ8BUDI"QQ͕ىಈ 
  9. (MBODFͷಈը ✴ IUUQZPVUVCFT#P&GGQD. UNT ✴ IUUQZPVUVCFSXWX;PD, UNT ✴ IUUQZPVUVCF&WTG,*UY* UN

    
  10. (MBODFͷ࡞Γํ

  11. (MBODFͷ࡞Γํ Ұ൪؆୯ͳͷ͸ʜ 8BUDI"QQͷλʔήοτΛ࡞Δͱ͖ʹ $IPPTFPQUJPOTGPSZPVSOFXUBSHFU ͷը໘Ͱ *ODMVEF(MBODF4DFOFʹ✓ 

  12. ҎԼ͕࡞੒͞ΕΔ 8BUDI,JU&YUFOTJPOάϧʔϓ಺ʹ (MBODF$POUSPMMFSTXJGU 8BUDI"QQάϧʔϓ಺ͷ4UPSZCPBSE಺ʹ (MBODF*OUFSGBDF 8,*OUFSGBDF$POUSPMMFSͷαϒΫϥεͳͷͰجຊతʹ
 8BUDI"QQͷը໘ͱͰ͖Δ͜ͱ͸ಉ͡ (MBODFͷ࡞Γํ  WJBIUUQTEFWFMPQFSBQQMFDPNMJCSBSZQSFSFMFBTF

    JPTEPDVNFOUBUJPO(FOFSBM$PODFQUVBM 8BUDI,JU1SPHSBNNJOH(VJEF 5IF(MBODF$POUSPMMFSIUNMBQQMF@SFGEPDVJE 51$)48 ͜ͷάϧʔϓফͤͳ͍ ͜ͷάϧʔϓফͤͳ͍
  13. (MBODF
 *OUFSGBDF(VJEFMJOFT

  14. (MBODF*OUFSGBDF(VJEFMJOFT ͙͢ʹ৘ใΛ఻͑ΒΕΔΑ͏ʹઃܭ͠·͢ɻ େྔͷจࣈΛදࣔͯ͠͸͍͚·ͤΜɻ
 άϥϑΟοΫεɺ৭ɺΞχϝʔγϣϯΛద੾ʹ ࢖༻͍ͯͩ͘͠͞ɻ ࠷΋ॏཁͳ৘ใʹয఺Λ౰͍ͯͯͩ͘͞ɻ
 (MBODF͸ΞϓϦʹมΘΔ΋ͷͰ͸͋Γ·ͤΜɻ ॏཁͳ৘ใͷΈΛτϦϛϯάͯ͠දࣔͯͩ͘͠ ͍͞ɻ ΠϯλϥΫςΟϒͳίϯτϩʔϧΛؚΊͳ͍

    Ͱ͍ͩ͘͞ɻ 
  15. (MBODF*OUFSGBDF(VJEFMJOFT ςʔϒϧͱϚοϓͷ࢖༻͸ආ͚ͨ΄͏͕͍͍ Ͱ͢ɻ
 ېࢭ͸͞Ε͍ͯ·ͤΜ͕ɺݶΒΕͨεϖʔε͸ ςʔϒϧɺϚοϓ͸༗༻Ͱ͸͋Γ·ͤΜɻ දࣔ͢Δ৘ใΛλΠϜϦʔʹ͍ͯͩ͘͠͞ɻ Ϣʔβʹ৘ใΛఏڙ͢ΔͨΊʹɺ
 ࣌ࠁ΍Ґஔ৘ใͳͲར༻Ͱ͖Δ͢΂ͯͷϦιʔ εΛ࢖༻͍ͯͩ͘͠͞ɻ 

  16. ƅшƅ 

  17. ͑ͬ

  18. Ξχϝʔγϣϯ  Ґஔ৘ใ

  19. 8BUDI,JUͰ Ͱ͖Μͷ

  20. Ξχϝʔγϣϯ

  21. Ξχϝʔγϣϯ ✴ 8,*OUFSGBDF*NBHFͰՄೳ ✴ ύϥύϥອըͰ͔͠ͳ͍ ✴ ͭͷύλʔϯ͕͋Δ ✴ ੩తͳը૾Λ࢖༻͢ΔΞχϝʔγϣϯ ✴

    ಈతͳը૾Λ࢖༻͢ΔΞχϝʔγϣϯ 
  22. Ξχϝʔγϣϯ ✴ EFNP 

  23. ੩తͳը૾Λ࢖༻ͨ͠
 Ξχϝʔγϣϯ

  24. ੩తͳը૾Λ࢖༻ͨ͠Ξχϝʔγϣϯ ✴ 4UPSZCPBSE͚ͩͰ࣮૷͢Δ৔߹ ✴ 8BUDI,JU"QQͷάϧʔϓ಺ ✴ *NBHFTYDBTTFUT಺ʹҎԼͷ໊લͷ*NBHF 4FUΛ࡞੒
 )PHF )PHF

    )PHF ʜ)PHF/ ✴ 4UPSZCPBSEͰ*NBHFΛ഑ஔ ✴ ഑ஔͨ͠*NBHFͷͰҎԼΛઃఆ ✴ *NBHF)PHF ✴ "OJNBUF:FT ✴ %VSBUJPO޷͖ͳ਺ࣈ େ͖͍΄ͲίϚ͕௕͍  ✴ "OJNBUFPO-PBE✓ 
  25. ✴ ࠶ੜ੍ޚ΋Ͱ͖Δ ✴ 8,*OUFSGBDF*NBHF ✴ TUBSU"OJNBUJOH ✴ TUBSU"OJNBUJOH8JUI*NBHFT*O3BOHF
 EVSBUJPOSFQFBU$PVOU ✴

    TUPQ"OJNBUJOH  ੩తͳը૾Λ࢖༻ͨ͠Ξχϝʔγϣϯ
  26. ಈతͳը૾Λ࢖༻ͨ͠ Ξχϝʔγϣϯ

  27. ✴ 8BUDI,JU&YUFOTJPOͰఆظతʹɺ
 6**NBHFΛಈతʹੜ੒ͯ͠ɺ 8,*OUFSGBDF*NBHFʹTFU*NBHF͢Δ  ಈతͳը૾Λ࢖༻ͨ͠Ξχϝʔγϣϯ ఆظతʹ6**NBHFΛੜ੒ 8,*OUFSGBDF*NBHFTFU*NBHF

  28.  ಈతͳը૾Λ࢖༻ͨ͠Ξχϝʔγϣϯ func generateImage() -> UIImage { UIGraphicsBeginImageContextWithOptions(CGSizeMake(100, 100), false,

    0) let context = UIGraphicsGetCurrentContext() func colorValue() -> CGFloat{ return CGFloat(arc4random_uniform(255)) / 255.0 } CGContextSetRGBFillColor(context, colorValue(), colorValue(), colorValue(), 1) CGContextFillRect(context, CGRectMake(0, 0, 100, 100)) let generatedImage = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() return generatedImage } ಈతʹ6**NBHFΛੜ੒͢Δ
  29.  @IBOutlet weak var dynamicImage: WKInterfaceImage! override func awakeWithContext(context: AnyObject?)

    { super.awakeWithContext(context) var timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: "updateImage", userInfo: nil, repeats: true) } func updateImage() { dynamicImage.setImage(generateImage()) } ಈతͳը૾Λ࢖༻ͨ͠Ξχϝʔγϣϯ λΠϚʔͰඵ͓͖ʹ8,*OUFSGBDF*NBHFʹ
 TFU*NBHF͢Δ
  30. Ґஔ৘ใ

  31. Ґஔ৘ใ ✴ "QQMF8BUDIʹ͸(14͸͍͍ͭͯͳ͍ ✴ J1IPOFͷ(14ͰҐஔ৘ใΛऔಘ͢Δ
 ඞཁ͕͋Δ 

  32. Ґஔ৘ใ ✴ J04ΞϓϦ ✴ *OGPQMJTUʹҎԼΛ௥ه ✴ /4-PDBUJPO"MXBZT6TBHF%FTDSJQUJPO ✴ ϢʔβʹҐஔ৘ใ΁ͷΞΫηεΛ
 ڐՄͯ͠΋Β͏

    ✴ MPDBUJPO.BOBHFSSFRVFTU"MXBZT"VUIPSJ [BUJPO  8BUDI&YUFOTJPO͕J04ͷ
 όοΫάϥ΢ϯυͰಈ͘ͷͰ"MXBZT
  33. Ґஔ৘ใ ✴ 8BUDI&YUFOTJPO ✴ $PSF-PDBUJPOͰҐஔ৘ใऔಘ ✴ MPDBUJPO.BOBHFSEJE6QEBUF-PDBUJPOTͰ
 8BUDI"QQͷ.BQΛߋ৽͢Δ 

  34. Ґஔ৘ใ ✴ σόοάํ๏ γϛϡϨʔλ  ✴ J04ΞϓϦΛىಈ͠ɺҐஔ৘ใ΁ͷΞΫηε ΛڐՄ ✴ 9DPEFͷϝχϡʔ%FCVH


    4JNVMBUF-PDBUJPO޷͖ͳ஍ҬΛબ୒ ✴ (MBODFΛىಈ͢Δ4DIFNFΛ࡞੒ͯ͠3VO 
  35. ͓·͚ )BOEPGG

  36. )BOEPGG ✴ (MBODFΛλοϓ͢Δͱɺ8BUDI"QQ͕ىಈ ͢Δ ✴ ىಈ࣌ʹදࣔ͢Δ*OUFSGBDF$POUSPMMFSΛࢦఆ ͢Δ͜ͱ͕Ͱ͖Δ ✴ ҎԼͷॱʹ"DUJWJUZΛड͚౉͢
 J04ΞϓϦˠ(MBODF


    ˠ8BUDI"QQͷ೚ҙͷը໘ 
  37. )BOEPGG  8BUDI"QQͷ4UPSZCPBSE͕͜͏ͳ͍ͬͯΔͱ͢Δ

  38.  )BOEPGG )BOEPGG͢Δ࣌ͷॲཧͷྲྀΕ

  39. )BOEPGG ✴ EFNP 

  40.  )BOEPGG (MBODF$POUSPMMFSTXJGU override func awakeWithContext(context: AnyObject?) { super.awakeWithContext(context) //

    Configure interface objects here. NSLog("%@ awakeWithContext", self) updateUserActivity("net.haranicle.watchHandoff.sample", userInfo: ["hoge":"piyo"]) } )BOEPGGͷ"DUJWJUZͷ*% VTFS*OGP΋ૹΕΔ
  41.  )BOEPGG 'JSTU*OUFSGBDF$POUSPMMFSTXJGU override func actionForUserActivity(userActivity: [NSObject : AnyObject]?, context:

    AutoreleasingUnsafeMutablePointer<AnyObject?>) -> String? { return "secondInterfaceControllerId" } 4FDPOEͷ*%Λ3FUVSO
  42. )BOEPGG  8BUDI"QQˠJ04ΞϓϦʹ"DUJWJUZΛ
 ड͚౉͢͜ͱ͸·ͩͰ͖ͳ͍ ͜Μͳײ͡Ͱಈ͘͸ͣʜ

  43. ·ͱΊ

  44. "QQMF8BUDIͷ(MBODFʹ͍ͭͯ ✴ (MBODF͸ΞϓϦͷॏཁͳ৘ใΛදࣔ͢Δ6* ✴ 8BUDI"QQ͸ͭͷ(MBODFΛ࣋ͭ͜ͱ͕Ͱ͖Δ ✴ Ξχϝʔγϣϯ΍Ґஔ৘ใΛ࢖༻͢Δ͜ͱ΋ Ͱ͖Δ ✴ Ξχϝʔγϣϯ͸੩తը૾PSಈతը૾Ͱ࣮ݱ

    Ͱ͖Δ ✴ J1IPOFͷ(14Λ࢖༻ͯ͠Ґஔ৘ใΛऔಘ͠ද ࣔ͢Δ͜ͱ΋Ͱ͖Δ ✴ )BOEPGG Ͱ(MBODFΛλοϓ࣌ʹىಈ͢Δ *OUFSGBDF$POUSPMMFSΛࢦఆ͢Δ͜ͱ͕Ͱ͖Δ 
  45. ࢀߟ ✴ "QQMF8BUDI1SPHSBNNJOH(VJEF ✴ IUUQTEFWFMPQFSBQQMFDPNMJCSBSZQSFSFMFBTFJPT EPDVNFOUBUJPO(FOFSBM$PODFQUVBM 8BUDI,JU1SPHSBNNJOH(VJEFJOEFYIUNM ✴ 8BUDI,JU'SBNFXPSL3FGFSFODF ✴

    IUUQTEFWFMPQFSBQQMFDPNMJCSBSZQSFSFMFBTFJPT EPDVNFOUBUJPO8BUDI,JU3FGFSFODF 8BUDI,JU@GSBNFXPSLJOEFYIUNM ✴ 8BUDI,JUͰݱࡏҐஔͷ஍ਤΛදࣔ͢Δ ✴ IUUQRJJUBDPN@UJE@JUFNT EGFFC ✴ "QQMF8BUDIͰॳΊͯొ৔ͨ͠৽6*ʮ(MBODFʯʹ͍ͭͯ ✴ IUUQCMPHIBSBOJDMFOFUHMBODF ✴ 8BUDI,JUͰ)BOEPGG ✴ IUUQCMPHIBSBOJDMFOFUXBUDILJU@IBOEPGG