How to study iOS (Long version)

How to study iOS (Long version)

It is a presentation material at ODC.

Eae7b6aeee72d3081b01d09a2d675f9a?s=128

Akio Itaya

August 25, 2018
Tweet

Transcript

  1. ࠳ં͠ͳ͍ iOS ษڧձͷཪଆ AKKEY / AKIO ITAYA Cyberagent, Inc. ODC

    2018
  2. ໊લɿ൘୩ ߊྑɹ/ɹ͖͋ͬʔ झຯɿυϥΠϒ ׆ಈɿ@AkkeyLab Cyberagent, Inc. MatchingAgent, Inc. େֶೖֶޙϓϩάϥϛϯάʹҰ໨ࠍΕɺ18೥৽ଔ iOS

    ΤϯδχΞ ࣗݾ঺հ
  3. None
  4. ࠳ં͠ͳ͍ iOS ษڧձͷཪଆ

  5. ର৅ͷֶੜ

  6. ର৅ͷֶੜ ɾϓϩάϥϛϯά ॳ৺ऀ ɾϓϩάϥϛϯά ܦݧऀʢतۀͰC/Javaʣ ɾϓϩάϥϛϯά ࠳ંܦݧऀ ɾϓϩάϥϛϯά ษڧ࢝Ίͨͱ͜Ζ

  7. ɾϓϩάϥϛϯά ॳ৺ऀ ɾϓϩάϥϛϯά ܦݧऀʢतۀͰC/Javaʣ ɾϓϩάϥϛϯά ࠳ંܦݧऀ ɾϓϩάϥϛϯά ษڧ࢝Ίͨͱ͜Ζ ର৅ͷֶੜ

  8. ɾϓϩάϥϛϯά ॳ৺ऀ ɾϓϩάϥϛϯά ܦݧऀʢतۀͰC/Javaʣ ɾϓϩάϥϛϯά ࠳ંܦݧऀ ɾϓϩάϥϛϯά ษڧ࢝Ίͨͱ͜Ζ ॳ৺ऀɾܦݧऀͷཱ྆ ର৅ͷֶੜ

  9. ɾϓϩάϥϛϯά ॳ৺ऀ ɾϓϩάϥϛϯά ܦݧऀʢतۀͰC/Javaʣ ɾϓϩάϥϛϯά ࠳ંܦݧऀ ɾϓϩάϥϛϯά ษڧ࢝Ίͨͱ͜Ζ ର৅ͷֶੜ

  10. ɾϓϩάϥϛϯά ॳ৺ऀ ɾϓϩάϥϛϯά ܦݧऀʢतۀͰC/Javaʣ ɾϓϩάϥϛϯά ࠳ંܦݧऀ ɾϓϩάϥϛϯά ษڧ࢝Ίͨͱ͜Ζ ਏ͍ࢥ͍Λۃྗͤ͞ͳ͍ ର৅ͷֶੜ

  11. ɾϓϩάϥϛϯά ॳ৺ऀ ɾϓϩάϥϛϯά ܦݧऀʢतۀͰC/Javaʣ ɾϓϩάϥϛϯά ࠳ંܦݧऀ ɾϓϩάϥϛϯά ษڧ࢝Ίͨͱ͜Ζ ର৅ͷֶੜ

  12. ɾϓϩάϥϛϯά ॳ৺ऀ ɾϓϩάϥϛϯά ܦݧऀʢतۀͰC/Javaʣ ɾϓϩάϥϛϯά ࠳ંܦݧऀ ɾϓϩάϥϛϯά ษڧ࢝Ίͨͱ͜Ζ तۀͱͷ࿈ಈΛར༻ ର৅ͷֶੜ

  13. ॳճߨٛ

  14. ॳճߨٛ ։ൃɿه೦ࡱӨΧϝϥΞϓϦ ݴޠɿSwift ࣌ؒɿ໿1࣌ؒ ྉۚɿແྉ

  15. ͱɺ͍͏͜ͱͰ…

  16. ॳճߨٛʹϦΞϧλΠϜνϟϨϯδʂ

  17. END

  18. ߨٛεϥΠυ

  19. 4FUVQ Swift 3

  20. %PXOMPBE IUUQTHJUIVCDPN"LLFZ-BC1IPUP(VSBTIJ

  21. 4FMFDU4JNVMBUPSBOE3VO 3VO

  22. 3VO

  23. 'JSTUTUFQ Swift 3

  24. -FU`TDPEJOH

  25. DPOUSPM -FU`TDPEJOH

  26. ɾWJFX%JE-PBEϝιουͷதʹϘλϯͷઃఆΛॻ͘ ɾϘλϯͷDVTUPN4FUUJOHϝιουΛݺͼग़͢ -FU`TDPEJOH

  27. ɾୈҰҾ਺ʹTFMGɺୈೋҾ਺ʹϘλϯʹදࣔ͢Δจࣈྻ ɾDPNNBOE TͰอଘ -FU`TDPEJOH

  28. 4FMFDUJ1IPOFBOE3VO -FU`TSVO

  29. -FU`TSVO

  30. w ߹੒͢ΔΩϟϥΫλʔΛม͍͑ͨ w ෳ਺ΩϟϥΫλʔʹରԠ͍ͤͨ͞ w τοϓը໘ʹഎܠը૾Λ෇͚͍ͨ w Ϙλϯͷ഑ஔΛม͍͑ͨ w ͳͲͳͲ

    ͲΜͳ޻෉͍ͨ͠ʁ
  31. to be continued …

  32. ޻෉ϙΠϯτ

  33. ޻෉ϙΠϯτ ɾ਺ߦॻ͚ͩ͘Ͱ׬੒ ɾൺֱతຊ֨తͳΞϓϦ͕ग़དྷ্͕Δ ɾʮվྑ͍ͨ͠ʂʯ͔Β࣍ͷֶशʹͭͳ͛Δ ɾਤղΛଟ༻ͨ͠εϥΠυ

  34. ޻෉ϙΠϯτ ɾ਺ߦॻ͚ͩ͘Ͱ׬੒ ɾൺֱతຊ֨తͳΞϓϦ͕ग़དྷ্͕Δ ɾʮվྑ͍ͨ͠ʂʯ͔Β࣍ͷֶशʹͭͳ͛Δ ɾਤղΛଟ༻ͨ͠εϥΠυ ॳ৺ऀͰ΋Մೳ

  35. ޻෉ϙΠϯτ ɾ਺ߦॻ͚ͩ͘Ͱ׬੒ ɾൺֱతຊ֨తͳΞϓϦ͕ग़དྷ্͕Δ ɾʮվྑ͍ͨ͠ʂʯ͔Β࣍ͷֶशʹͭͳ͛Δ ɾਤղΛଟ༻ͨ͠εϥΠυ ࠳ંΛ๷ࢭ͠ɺָ͍͠ͱࢥͬͯ΋Β͏

  36. ޻෉ϙΠϯτ ɾ਺ߦॻ͚ͩ͘Ͱ׬੒ ɾൺֱతຊ֨తͳΞϓϦ͕ग़དྷ্͕Δ ɾʮվྑ͍ͨ͠ʂʯ͔Β࣍ͷֶशʹͭͳ͛Δ ɾਤղΛଟ༻ͨ͠εϥΠυ ࣮ફతͳֶͼΛҙࣝ

  37. ޻෉ϙΠϯτ ɾ਺ߦॻ͚ͩ͘Ͱ׬੒ ɾൺֱతຊ֨తͳΞϓϦ͕ग़དྷ্͕Δ ɾʮվྑ͍ͨ͠ʂʯ͔Β࣍ͷֶशʹͭͳ͛Δ ɾਤղΛଟ༻ͨ͠εϥΠυ ܽ੮ऀͰ΋ֶ΂Δ

  38. ߨٛεϥΠυ

  39. 46 "CPVU Swift 3

  40. 47 2VFTUJPO ͳͥ͜ͷߦ͚ͩͰʁ

  41. 48 4USVDUVSF #BTF7JFX$POUSPMMFS

  42. 49 4USVDUVSF #BTF7JFX$POUSPMMFSʢܧঝݩʣ #BTF7JFX$POUSPMMFSΛܧঝ͍ͯ͠Δ

  43. 50 8IBUܧঝ ܧঝʢ͚͍͠ΐ͏ɺJOIFSJUBODFΠϯϔϦλϯεʣͱ͸ΦϒδΣΫτࢦ޲Λߏ੒͢Δ֓೦ͷҰͭ Ͱ͋Δɻ͋ΔΦϒδΣΫτ͕ଞͷΦϒδΣΫτͷಛੑΛҾ͖ܧ͙৔߹ɺ྆ऀͷؒʹʮܧঝؔ܎ʯ ͕͋ΔͱݴΘΕΔɻओʹΫϥεϕʔεͷΦϒδΣΫτࢦ޲ݴޠͰɺطଘΫϥεͷػೳɺߏ଄Λڞ ༗͢Δ৽ͨͳΫϥεΛ೿ੜ͢Δ͜ͱ͕Ͱ͖ʢαϒΫϥεԽʣɺͦͷΑ͏ͳΫϥε͸ʮ਌Ϋϥε ʢεʔύʔΫϥεʣΛܧঝͨ͠ʯͱ͍͏ɻ۩ମతʹ͸ม਺ఆٛ΍ૢ࡞ʢϝιουʣͳͲ͕Ҿ͖ܧ ͕ΕΔɻ·ͨ+BWBͷΠϯλϑΣʔεܧঝͷΑ͏ʹػೳηοτͷ࢓༷ͷΈΛҾ͖ܧ͙৔߹΋͋Δɻ CZXJLJQFEJB <#BTF7$ͷ಺༰ΛؚΉ.BJO7$>

    ίϐϖ͠ͳͯ͘΋࢖͑ΔΑ͏ʹͳΔ ˣ ڞ௨ͷॲཧ͸̍ճ͚ͩॻ͍ͯܧঝʂ ͜Ε͕ຐ๏ͷਖ਼ମͰ͢ʂ
  44. 51 #BTF7JFX$POUSPMMFS w TFU#,*NBHF @JNBHF7JFX6**NBHF7JFX  Ҿ਺ʹ༩͑ͨJNBHFΛഎܠʹઃఆ͢Δ w UJNF#PPMFBO @TUBSU5JNF6*OU

    HPBM5JNF6*OU #PPM TFU#,*NBHFͰ࢖༻͞Ε͍ͯΔ w PO$MJDL#VUUPO @TFOEFS6*#VUUPO  <0WFSSJEF>Ϙλϯ͕ΫϦοΫ͞Εͨͱ͖ʹݺ͹ΕΔ
  45. 52 8IBUPWFSSJEF ࣮͸ɺ6*7$ʹPO$MJDL#VUUPOϝιουΛ ௥Ճ͍ͯͨ͠ͷͰ͢ɻ ΦϒδΣΫτࢦ޲ϓϩάϥϛϯάʹ͓͍ͯΦʔόʔϥΠυ PWFSSJEF ͱ͸ɺεʔύʔΫϥεͰఆ ٛ͞ΕͨϝιουΛαϒΫϥεͰఆٛ͠ͳ͓͠ɺಈ࡞Λ্ॻ͖͢Δ͜ͱͰ͋Δɻ CZXJLJQFEJB ॲཧͳ͠

  46. 53 8IBUPWFSSJEF ࣮͸ɺ6*7$ʹPO$MJDL#VUUPOϝιουΛ ௥Ճ͍ͯͨ͠ͷͰ͢ɻ ΦϒδΣΫτࢦ޲ϓϩάϥϛϯάʹ͓͍ͯΦʔόʔϥΠυ PWFSSJEF ͱ͸ɺεʔύʔΫϥεͰఆ ٛ͞ΕͨϝιουΛαϒΫϥεͰఆٛ͠ͳ͓͠ɺಈ࡞Λ্ॻ͖͢Δ͜ͱͰ͋Δɻ CZXJLJQFEJB ॲཧͳ͠

    ॲཧΛ্ॻ͖ ࠓճ͸௥Ճ ͪͳΈʹɺ͜͜ʹॻ͔Ε͍ͯΔॲ ཧ͸ɺΧϝϥࡱӨΛߦ͏ը໘ʹભ Ҡ͢ΔॲཧͰ͢ɻ
  47. 54 4ZTUFN 6*7JFX$POUSPMMFS #BTF7JFX$POUSPMMFS ܧঝ .BJO7JFX$POUSPMMFS ܧঝ $VTUPN#VUUPOTXJGU ֦ு 6*#VUUPO

    ֦ு ࠓճࢲୡ͕৮͍ͬͯΔΫϥεͰ͢ɻ എܠը૾ͷઃఆॲཧɾϘλϯΛԡ͠ ͨͱ͖ͷॲཧؚ͕·Ε͍ͯ·͢ɻ ͳ͓ɺ͜ͷΫϥε͸൘୩͕ຐ๏ͱݴͬ ͯ࢓ࠐΜͩ΋ͷͰ͢ɻ $PDPBUPVDIϑϨʔϜϫʔΫ ʹؚ·ΕΔΫϥεͷҰͭͰ͢ɻ ͳ͓ɺ͜ͷΫϥε͸"QQMF͕४ උ͍ͯ͠Δ΋ͷʹͳΓ·͢ɻ Ϙλϯͷ৭ɾαΠζɾܗɾλΠτϧɾ λΠτϧจࣈ৭ɾԡ͞Εͨͱ͖ʹݺ ͹ΕΔϝιουͷొ࿥͕هड़͞Εͨ DVTUPN4FUUJOHϝιουΛ௥Ճͯ͠ ͍·͢ɻ·ͨɺԡ͞Εͨͱ͖ʹݺ͹ ΕΔϝιουΛ6*7$ʹԾ௥Ճ͢Δ ॲཧ΋هड़͍ͯ͠·͢ɻ $PDPBUPVDIϑϨʔ ϜϫʔΫʹؚ·ΕΔ ΫϥεͷҰͭͰ͢ɻ ͳ͓ɺ͜ͷΫϥε͸ "QQMF͕४උ͍ͯ͠ Δ΋ͷʹͳΓ·͢ɻ
  48. 55 $VTUPN J[F Swift 3

  49. 56 w ߹੒͢ΔΩϟϥΫλʔΛม͍͑ͨ w ෳ਺ΩϟϥΫλʔʹରԠ͍ͤͨ͞ w τοϓը໘ʹഎܠը૾Λ෇͚͍ͨ w Ϙλϯͷ഑ஔΛม͍͑ͨ w

    ͳͲͳͲ ͲΜͳ޻෉͍ͨ͠ʁ
  50. 4FU6**NBHF7JFX 57 ᶃ ᶄ ᶅ ύʔπҰཡ͔Βʮ*NBHF7JFXʯΛબΜͰ഑ஔ͠Α͏ʂ ϦετͰ্ʹ͋Δ΄Ͳ֊૚తʹ͸ԼͰ͋Δɻ ͳͷͰɺϦετ্Ͱ͸ϘλϯΑΓ্ʹ഑ஔ͠Α͏ʂ ޷ΈͰߏΘͳ͍͕ɺࠓճ͸σϑΥϧτͷը૾͕ J1IPOFαΠζͳͷͰɺը໘αΠζͱಉ͡ʹ6**NBHF7JFX

    Λઃఆͯ͠ΈΑ͏ʂ ্Լࠨӈɺը໘ͱͷ༨നΛθϩʹ͢Δ͜ͱͰɺ ը໘શମʹ6**NBHF7JFX͕දࣔ͞ΕΔΑ͏ʹ͠Α͏ʂ
  51. 4FU6**NBHF7JFX 58 ᶃ ᶄ ɿDPOUSPMΛԡ͠ͳ͕Β%%ͯ͠ίʔυʹඥ෇͚ ɿTFU#,*NBHFϝιουΛWJFX%JE-PBEϝιου಺ʹ௥Ճ Ҿ਺ʹ6**NBHF7JFXΛ౉͢

  52. -FU`TDIBMMFOHF 59 ը૾ͷ௥Ճͱมߋ͕͍ͨ͠ʂ

  53. "EEJNBHFGJMF 60 ᶃ ᶄ ᶅ

  54. 61 w ߹੒͢ΔΩϟϥΫλʔΛม͍͑ͨ w ෳ਺ΩϟϥΫλʔʹରԠ͍ͤͨ͞ w τοϓը໘ʹഎܠը૾Λ෇͚͍ͨ w Ϙλϯͷ഑ஔΛม͍͑ͨ w

    ͳͲͳͲ ͲΜͳ޻෉͍ͨ͠ʁ
  55. "EEUISFFCVUUPO 62 6*ͱͷϦϯΫ Ϙλϯͷઃఆ

  56. -FU`TSVO 63 શ෦ಉ͡ΩϟϥΫλʔͩͶʜ

  57. "EECVUUPOUBH 64 Ϙλϯࣝผλά

  58. "EECVUUPOBDUJPO 65 .BJO7JFX$POUSPMMFSDMBTTʹPO$MJDL#VUUPOϝιουΛ௥Ճ TXJUDIจΛ௥Ճ֤ͯ͠छը໘ભҠॲཧΛهड़

  59. 4XJGU4XJUDI 66 IUUQTEFWFMPQFSBQQMFDPNMJCSBSZDPOUFOUEPDVNFOUBUJPO4XJGU$PODFQUVBM4XJGU@1SPHSBNNJOH@-BOHVBHF$POUSPM'MPXIUNM $ݴޠͱҧ͍ɺ֤DBTFͰSFUVSO͞ΕΔ͜ͱʹ஫ҙ

  60. "EECVUUPOBDUJPO 67

  61. 2VFTUJPO 68 w PWFSSJEFͰ্ॻ͖Ͱ͸ͳ͘ॲཧ௥ՃΛ࣮ݱ͢Δʹ͸ʁ w PO$MJDL#VUUPOϝιου಺ͷॲཧͷ৑௕Λղফ͢Δʹ͸ʁ

  62. 2VFTUJPO 69 w PWFSSJEFͰ্ॻ͖Ͱ͸ͳ͘ॲཧ௥ՃΛ࣮ݱ͢Δʹ͸ʁ w PO$MJDL#VUUPOϝιου಺ͷॲཧͷ৑௕Λղফ͢Δʹ͸ʁ

  63. to be continued …

  64. ޻෉ϙΠϯτ

  65. ޻෉ϙΠϯτ ɾΧελϚΠζ͕Մೳ ɾֶͼͷछͱͳΔ࣮૷Λ೷͚Δ ɾΘ͟ͱඇޮ཰ͳճ౴ྫΛઌʹݟͤΔ

  66. ޻෉ϙΠϯτ ɾΧελϚΠζ͕Մೳ ɾֶͼͷछͱͳΔ࣮૷Λ೷͚Δ ɾΘ͟ͱඇޮ཰ͳճ౴ྫΛઌʹݟͤΔ ܦݧऀͰ΋ָ͠ΊΔ

  67. ޻෉ϙΠϯτ ɾΧελϚΠζ͕Մೳ ɾֶͼͷछͱͳΔ࣮૷Λ೷͚Δ ɾΘ͟ͱඇޮ཰ͳճ౴ྫΛઌʹݟͤΔ ίʔυΛಡΉྗΛ෇͚Δ

  68. ޻෉ϙΠϯτ ɾΧελϚΠζ͕Մೳ ɾֶͼͷछͱͳΔ࣮૷Λ೷͚Δ ɾΘ͟ͱඇޮ཰ͳճ౴ྫΛઌʹݟͤΔ ࣍΁ͷࣗ৴΋෇͚ͯ΋Β͏

  69. ͔Β͘Γ঺հ

  70. Class ViewController: BaseViewController { override func viewDidLoad() } Class BaseViewController:

    UIViewController { override func onClickButton(_ sender: UIButton) func setBKImage(_ imageView: UIViewController) func isTime(_ startTime: Int, goalTime: Int) -> Bool } extension UIButton { func customSetting(_ vc: UIViewController, title: String) var randomColor: UIColor func onClickButton(_ sender: UIButton) } શମ
  71. Class ViewController: BaseViewController { override func viewDidLoad() } Class BaseViewController:

    UIViewController { override func onClickButton(_ sender: UIButton) func setBKImage(_ imageView: UIViewController) func isTime(_ startTime: Int, goalTime: Int) -> Bool } extension UIButton { func customSetting(_ vc: UIViewController, title: String) var randomColor: UIColor func onClickButton(_ sender: UIButton) } શମ
  72. Class ViewController: BaseViewController { override func viewDidLoad() } Class BaseViewController:

    UIViewController { override func onClickButton(_ sender: UIButton) func setBKImage(_ imageView: UIViewController) func isTime(_ startTime: Int, goalTime: Int) -> Bool } extension UIButton { func customSetting(_ vc: UIViewController, title: String) var randomColor: UIColor func onClickButton(_ sender: UIButton) } શମ
  73. Class ViewController: BaseViewController { override func viewDidLoad() } Class BaseViewController:

    UIViewController { override func onClickButton(_ sender: UIButton) func setBKImage(_ imageView: UIViewController) func isTime(_ startTime: Int, goalTime: Int) -> Bool } extension UIButton { func customSetting(_ vc: UIViewController, title: String) var randomColor: UIColor func onClickButton(_ sender: UIButton) } શମ
  74. Class ViewController: BaseViewController { override func viewDidLoad() } Class BaseViewController:

    UIViewController { override func onClickButton(_ sender: UIButton) func setBKImage(_ imageView: UIViewController) func isTime(_ startTime: Int, goalTime: Int) -> Bool } extension UIButton { func customSetting(_ vc: UIViewController, title: String) var randomColor: UIColor func onClickButton(_ sender: UIButton) } ىಈ
  75. Class ViewController: BaseViewController { override func viewDidLoad() } Class BaseViewController:

    UIViewController { override func onClickButton(_ sender: UIButton) func setBKImage(_ imageView: UIViewController) func isTime(_ startTime: Int, goalTime: Int) -> Bool } extension UIButton { func customSetting(_ vc: UIViewController, title: String) var randomColor: UIColor func onClickButton(_ sender: UIButton) } ىಈ
  76. Class ViewController: BaseViewController { override func viewDidLoad() } Class BaseViewController:

    UIViewController { override func onClickButton(_ sender: UIButton) func setBKImage(_ imageView: UIViewController) func isTime(_ startTime: Int, goalTime: Int) -> Bool } extension UIButton { func customSetting(_ vc: UIViewController, title: String) var randomColor: UIColor func onClickButton(_ sender: UIButton) } นࢴ
  77. Class ViewController: BaseViewController { override func viewDidLoad() } Class BaseViewController:

    UIViewController { override func onClickButton(_ sender: UIButton) func setBKImage(_ imageView: UIViewController) func isTime(_ startTime: Int, goalTime: Int) -> Bool } extension UIButton { func customSetting(_ vc: UIViewController, title: String) var randomColor: UIColor func onClickButton(_ sender: UIButton) } นࢴ
  78. Program code detail

  79. Import UIKit Class ViewController: BaseViewController { override func viewDidLoad() {

    // code } }
  80. Import UIKit Class ViewController: BaseViewController { @IBOutlet weak var button:

    UIButton! override func viewDidLoad() { button.customSetting(self, title: ”Camera”) } }
  81. Import UIKit Class ViewController: BaseViewController { @IBOutlet weak var button:

    UIButton! override func viewDidLoad() { button.customSetting(self, title: ”Camera”) } }
  82. Import UIKit extension UIButton { func customSetting(_ vc: UIViewController, title:

    String) { frame = CGRect(x: 0, y: 0, width: 80, height: 80) backgroundColor = randomColor layer.maskToBounds = true layer.cornerRadius = 40 titleLabel?.font = .systemFont(ofSize: .buttonFontSize) setTitle(title, for: .normal) setTitleColor(.white, for: .normal) addTarget(vc, action: #selector(vc.onClickButton(_:)), for: .touchUpInside) } }
  83. Import UIKit extension UIButton { func customSetting(_ vc: UIViewController, title:

    String) { frame = CGRect(x: 0, y: 0, width: 80, height: 80) backgroundColor = randomColor layer.maskToBounds = true layer.cornerRadius = 40 titleLabel?.font = .systemFont(ofSize: .buttonFontSize) setTitle(title, for: .normal) setTitleColor(.white, for: .normal) addTarget(vc, action: #selector(vc.onClickButton(_:)), for: .touchUpInside) } }
  84. Import UIKit extension UIViewController { func onClickButton(_ sender: UIButton) {}

    }
  85. Import UIKit Class BaseViewController: UIViewController { override func onClickButton(_ sender:

    UIButton) { let vc = CameraViewController() vc.view.backgroundColor = .white vc.setCharaImage(”04”) self.present(vc, animated: true, completion nil) } }
  86. Import UIKit extension UIButton { func customSetting(_ vc: UIViewController, title:

    String) { frame = CGRect(x: 0, y: 0, width: 80, height: 80) backgroundColor = randomColor layer.maskToBounds = true layer.cornerRadius = 40 titleLabel?.font = .systemFont(ofSize: .buttonFontSize) setTitle(title, for: .normal) setTitleColor(.white, for: .normal) addTarget(vc, action: #selector(vc.onClickButton(_:)), for: .touchUpInside) } }
  87. Import UIKit extension UIButton { var randomColor: UIColor { switch

    arc4random_uniform(5) case 0: return .magenta case 1: return .purple case 2: return .red case 3: return .orange case 4: return .yellow default: return .clear } }
  88. Customize method

  89. Import UIKit Class ViewController: BaseViewController { func setBKImage(_ imageView: UIViewController)

    { if var topImage = UIImage(named: ”p1”), isTime(0, goalTime: 4) { let vc = CameraViewController() vc.view.backgroundColor = .white vc.setCharaImage(”04”) self.present(vc, animated: true, completion nil) } } }
  90. Import UIKit Class ViewController: BaseViewController { func setBKImage(_ imageView: UIViewController)

    { if var topImage = UIImage(named: ”p1”), isTime(0, goalTime: 4) { let vc = CameraViewController() vc.view.backgroundColor = .white vc.setCharaImage(”04”) self.present(vc, animated: true, completion nil) } } }
  91. Import UIKit Class ViewController: BaseViewController { func isTime(_ start: Int,

    goal: Int) -> Bool { let now = Date(), formatter = IDateFormatter() formatter.locale = Locale(identifier: ”ja_JP”) formatter.dateFormat = ”HH” let nowTime = formatter.string(from: now) for i in start…goal { let time = NSString(format: ”%02d”, i)) as String if nowTime == time { return true } } } }
  92. github.com/AkkeyLab/PhotoGurashi

  93. Thank you !