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

Apple WatchのGlanceについて

haranicle
December 20, 2014

Apple WatchのGlanceについて

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

haranicle

December 20, 2014
Tweet

More Decks by haranicle

Other Decks in Technology

Transcript

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

    8BUDI'BDF ͔Β্ʹεϫΠϓͰදࣔ ✴ (MBODFϖʔδ ը໘શମͰදࣔ  ✴ ԣεϫΠϓͰଞͷ(MBODFʹ੾Γସ͑ ✴ λοϓ͢ΔͱରԠ͢Δ8BUDI"QQ͕ىಈ 
  2. ੩తͳը૾Λ࢖༻ͨ͠Ξχϝʔγϣϯ ✴ 4UPSZCPBSE͚ͩͰ࣮૷͢Δ৔߹ ✴ 8BUDI,JU"QQͷάϧʔϓ಺ ✴ *NBHFTYDBTTFUT಺ʹҎԼͷ໊લͷ*NBHF 4FUΛ࡞੒
 )PHF )PHF

    )PHF ʜ)PHF/ ✴ 4UPSZCPBSEͰ*NBHFΛ഑ஔ ✴ ഑ஔͨ͠*NBHFͷͰҎԼΛઃఆ ✴ *NBHF)PHF ✴ "OJNBUF:FT ✴ %VSBUJPO޷͖ͳ਺ࣈ େ͖͍΄ͲίϚ͕௕͍  ✴ "OJNBUFPO-PBE✓ 
  3.  ಈతͳը૾Λ࢖༻ͨ͠Ξχϝʔγϣϯ 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Λੜ੒͢Δ
  4.  @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͢Δ
  5. Ґஔ৘ใ ✴ J04ΞϓϦ ✴ *OGPQMJTUʹҎԼΛ௥ه ✴ /4-PDBUJPO"MXBZT6TBHF%FTDSJQUJPO ✴ ϢʔβʹҐஔ৘ใ΁ͷΞΫηεΛ
 ڐՄͯ͠΋Β͏

    ✴ MPDBUJPO.BOBHFSSFRVFTU"MXBZT"VUIPSJ [BUJPO  8BUDI&YUFOTJPO͕J04ͷ
 όοΫάϥ΢ϯυͰಈ͘ͷͰ"MXBZT
  6. Ґஔ৘ใ ✴ σόοάํ๏ γϛϡϨʔλ  ✴ J04ΞϓϦΛىಈ͠ɺҐஔ৘ใ΁ͷΞΫηε ΛڐՄ ✴ 9DPEFͷϝχϡʔ%FCVH


    4JNVMBUF-PDBUJPO޷͖ͳ஍ҬΛબ୒ ✴ (MBODFΛىಈ͢Δ4DIFNFΛ࡞੒ͯ͠3VO 
  7.  )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΋ૹΕΔ
  8.  )BOEPGG 'JSTU*OUFSGBDF$POUSPMMFSTXJGU override func actionForUserActivity(userActivity: [NSObject : AnyObject]?, context:

    AutoreleasingUnsafeMutablePointer<AnyObject?>) -> String? { return "secondInterfaceControllerId" } 4FDPOEͷ*%Λ3FUVSO
  9. "QQMF8BUDIͷ(MBODFʹ͍ͭͯ ✴ (MBODF͸ΞϓϦͷॏཁͳ৘ใΛදࣔ͢Δ6* ✴ 8BUDI"QQ͸ͭͷ(MBODFΛ࣋ͭ͜ͱ͕Ͱ͖Δ ✴ Ξχϝʔγϣϯ΍Ґஔ৘ใΛ࢖༻͢Δ͜ͱ΋ Ͱ͖Δ ✴ Ξχϝʔγϣϯ͸੩తը૾PSಈతը૾Ͱ࣮ݱ

    Ͱ͖Δ ✴ J1IPOFͷ(14Λ࢖༻ͯ͠Ґஔ৘ใΛऔಘ͠ද ࣔ͢Δ͜ͱ΋Ͱ͖Δ ✴ )BOEPGG Ͱ(MBODFΛλοϓ࣌ʹىಈ͢Δ *OUFSGBDF$POUSPMMFSΛࢦఆ͢Δ͜ͱ͕Ͱ͖Δ 
  10. ࢀߟ ✴ "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