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

SwiftUIと宣言的UI/SwiftUIAndDeclarativeUI

sonatard
December 09, 2019

 SwiftUIと宣言的UI/SwiftUIAndDeclarativeUI

sonatard

December 09, 2019
Tweet

More Decks by sonatard

Other Decks in Programming

Transcript

  1. ͦͳଠ @sonatard D Technologies • ωοτϫʔΫɺLinuxαʔόΠϯϑϥ 4೥ • RTOS, Socket,

    TCP/IP, DHCP, DNS࣮૷ 7೥ • GAE/Go 2.5೥ • TypeScript, React 5ϲ݄ • iOS, Swift 2ϲ݄ • ΞʔΩςΫνϟɺOOP • MVCܥ • Clean Architecture • ϦϑΝΫλϦϯά • OOP, SOLIDݪଇ • ৽͍͠ύϥμΠϜΛษڧͯ͠ɺγεςϜ΍ ίʔυΛγϯϓϧʹ͢Δ͜ͱ͕޷͖ • ࠷ۙͷϒʔϜ͸GraphQLͱRx(Swift)
  2. 3 ৽͍͠ύϥμΠϜΛֶͼཧղ͢Δͱ͍͏͜ͱ w ৽͍͠πʔϧ͕ొ৔͢Δͱ͍ͭ࢖͍ͨ͘ͳΔʂ w ͔ͦ͠͠ͷπʔϧͷ໨తΛཧղ͠ͳ͍··ݕ౼͢Δͱɺద੾ͳٕज़બ୒͕ࠔ೉ ʹͳΔɻ w 3FBDU͸ɺK2VFSZͷ࣍ʹྲྀߦͬͨΈΜͳ͕࢖͍ͬͯΔྑͦ͞͏ͳϑϨʔϜϫʔΫʁ w

    4XJGU6*͸ɺ4XJGUʹରԠͨ͠৽͍͠6*ϑϨʔϜϫʔΫʁ w (SBQI2-͸ɺ3&45ͷ୅ସͰϨεϙϯεϑΟϧλʔͰ͖ͯɺεΩʔϚॻ͚Δ΋ͷʁ w 3Y͸ɺඇಉظ௨৴Λ͖ͬ͢Γॻ͚Δ΋ͷʁ w %PDLFS͸ɺߴ଎ʹىಈ͢Δ7.ʁ w (P͸ɺΫϩείϯύΠϧͰ͖Δ͔ΒίϚϯυϥΠϯπʔϧ࡞ΔͨΊͷ΋ͷʁ w ͜͏͍͏ཧղͩͱؒҧͬͨ··࢖͏͔ɺޡͬͨ൑அͰ࠾༻Λݟૹͬͯ͠·͏ w ࠓճ͸ɺ3FBDU΍4XJGU6*ͷϕʔεͱͳΔએݴత6*ʹֶ͍ͭͯͿ͜ͱͰɺΈͳ ͞Μ͕ٕज़બ୒Λ͢Δࡍͷ͓ख఻͍͕Ͱ͖Ε͹ͱࢥ͍·͢ɻ
  3. 8 ͸͡Ίʹ w ͦͷͨΊ͜͏͍͏൑அ͸ޡΓ w ʮҎલʹൺ΂ͯYYYͷ"1*͕࢖͍ͮΒ͍͔Βෆ࠾༻ʯ w ͜Ε͸0, w ʮએݴత6*ʹՁ஋Λײ͡ͳ͍͔Βෆ࠾༻ʯ

    w ʮએݴత6*ʹՁ஋Λײ͡Δ͕ɺ·ͩ੒ख़ͯ͠ͳ͍ͨΊෆ࠾༻ʯ w େ͖ͳύϥμΠϜʹରٕͯ͠ज़બ୒Λ͢Δ΂͖Ͱɺࡉ͔͍࣮૷खஈ͸ ࠣࡉͳ໰୊ w վળ΋ظ଴Ͱ͖Δ
  4. 10

  5. 11

  6. 12

  7. 13

  8. 14 એݴత6*ͷීٴ w એݴత6*͸ඞཁͰ͋Ε͹࢖͏΋ͷͰ͸ͳ͘ɺ(6*ͷ࣮૷ํ๏ͷඪ४ʹ ͳΓಘΔ w ΞϓϦͷੈքͰ͸એݴత6*Λ࣮ݱ͢ΔϑϨʔϜϫʔΫ͕ओྲྀͰ͸ͳ ͔͕ͬͨɺ4XJGU6*ͱ+FUQBDL$PNQPTF͕ެ͔ࣜΒఏڙ͞ΕΔ͜ͱͰ େ͖͘ঢ়گ͕มΘͬͨ w

    J04ɺ"OESPJEɺ'MVUUFSɺ3FBDU/BUJWFɺ8FCϑϩϯτΤϯυ 3FBDU  7VF "OHVMBS ʜ w ݱࡏओྲྀͷ(6*։ൃ؀ڥͷ͢΂͕ͯએݴత6*Λ࠾༻ w ϑϩϯτΤϯυͰ͸ɺΑ΄Ͳͷཧ༝͕ͳ͍ݶΓ৽نͰK2VFSZΛ࠾༻͢ Δ͜ͱ͸ͳ͍͕ɺJ04ͱ"OEPJSE΋ಉ͡ʹͳΔ  w େ͖ͳస׵ظͰ͋ΓΞϓϦͷੈքͰେ͖ͳύϥμΠϜγϑτ͕ى͖Δ
  9. 16 એݴత6*ʜ w ͔͠͠3FBDU͕ϦϦʔε͞Ε͔ͯΒ௕͍ظཱ͕͕ؒͭɺ͋·Γએݴత 6*ࣗମͷ࿩͸ࣖʹ͠ͳ͍ w 3FBDUΛॻ͍͍ͯͯ΋ҙࣝͯ͜͠ͳ͔ͬͨਓ΋ଟ͍  w ԿނͳΒએݴత6*Λҙࣝͤͣͱ΋ϑϨʔϜϫʔΫʹै͑͹ͦͷϝϦο

    τΛڗडͰ͖Δ w ͦͷͨΊඞͣݕ౼͕ඞཁͳ7.ͷεςʔτ؅ཧɺಛʹ3FEVYͷΞʔΩ ςΫνϟʹ͍ͭͯٞ࿦͕த৺Ͱ͋ͬͨΑ͏ʹײ͡Δ w ͔͠͠ύϥμΠϜΛཧղͤͣʹɺϑϨʔϜϫʔΫΛར༻͢Δ͚ͩͰ͸ ద੾ͳ࢖͍ํ͕Ͱ͖ͳ͍ɻ w ͜Ε͚ͩେ͖ͳύϥμΠϜΛཧղ͠ͳ͍͜ͱ͸ͱͯ΋໪ମແ͍
  10. • ͸ ͡ Ί ʹ • એ ݴ త U

    I ͱ ͸ • એ ݴ త U I Λ ࠾ ༻ ͠ ͨ ઌ ͷ ՝ ୊ - ঢ় ଶ ؅ ཧ • R e a c t ͷ ਐ Խ • Ξ ʔ Ω ς Ϋ ν ϟ
  11. 19 ໋ྩతͱએݴత w ໋ྩత w )PX w ԿΛ͢Δ͔Λهड़͢Δ w ࠷ऴతͳ݁Ռ͕લճͷ࣮ߦ݁Ռʹґଘ͢Δ

    w એݴత w 8IBU w Ͳ͏͍͏ঢ়ଶʹͳ͍ͬͯΔ͔Λهड़͢Δ w ࠷ऴతͳ݁Ռ͕લճͷ࣮ߦ݁Ռʹґଘ͠ͳ͍
  12. 21 એݴత6*ͷ۩ମྫ w $6* ಈతͳύϥϝʔλ͕ଘࡏ͢Δ৔߹  w $6*ͷදࣔ͸ɺಈతͳύϥϝʔλҎ֎͸มΘΒͳ͍ɻ w ίʔυ͕ͦͷ··6*Λදݱ͍ͯͯ͠Πϝʔδ͠΍͍͢ɻ

    DVJ͜Μʹͪ͸  ͜Μʹͪ͸  DVJIFMMP  IFMMP 
  13. 28 ಈతͳ(6*ʹ͓͚Δ໋ྩతͳίʔυͷ೉͠͞ w CVUUPOΛΫϦοΫ͢Δͱ)FMMP͕૿͍͑ͯ͘ը໘ EJW EJW EJW )FMMP EJW ΫϦοΫ

    Πϕϯτ EJW )FMMP)FMMP EJW Πϕϯτ͕ൃՐ͢Δͱ ͜͏͍͏ݟͨ໨ʹͳ͍ͬͯ͘ͷ͔ ࣌ؒ࣠ ΫϦοΫ Πϕϯτ
  14. 31 ಈతͳ(6*Ͱͷએݴత6*Λ࣮ݱ͢ΔͨΊʹ͸ w աڈͷ՝୊ w (6*ΞϓϦͰ΋$6*ͱಉ͡Α͏ʹঢ়ଶߋ৽͝ͱʹը໘ભҠͯ͢͠΂ ͯΛ࠶ඳը͠௚ͤ͹ίʔυ্͸એݴతʹͳΔ͕ʜ w ຖճ͢΂ͯΛ࠶ඳը͢Δ͜ͱ͕ίʔυͱͯ͠ݱ࣮తͰ͸ͳ͍ w

    ঢ়ଶʹԠͯࣗ͡ಈతʹ࠶ඳը͍ͨ͠ w ຖճը໘͢΂ͯΛ࠶ඳը͢Δͱ஗͍ w 4XJGU6*ͷొ৔ w એݴతʹ7JFXΛදݱ w ঢ়ଶ͕ߋ৽͞ΕΔͱࣗಈతʹ7JFX͕࠶ඳը w ঢ়ଶ͕มԽʹӨڹΛड͚Δ෦෼͚ͩ࠶ඳը
  15. 33 7JFX.PEFMʹԠͯ͡7JFX͕มΘΔྫΛ঺հ w )FMMP͕ͳ͍৔߹͸ɺѫࡰͳ͠ w BEE͢Δͱɺ)FMMPʹஔ͖׵ΘΔɻ w BEEͰ)FMMP͕ͭ૿͑Δɻ w ӈͷਤ͸ߋʹճBEEPΛԡͨ͠

    w SFNPWFͰ)FMMP͕ͭফ͑Δɻ w ӈͷਤ͸ճSFNPWFΛԡͨ͠ w )FMMP͕ͳ͍৔߹͸ɺѫࡰͳ͠ɻ w ӈͷਤ͸ճSFNPWFΛԡͨ͠ IFMMPͷ਺͚ͩ 6*-BCFM͕௥Ճ͞ΕΔ
  16. 37 6*5BCMF7JFX͕͋Ε͹4XJGU6*͸ෆཁͳͷ͔ʁ w 6*5BCMF7JFX͕એݴతʹهड़Ͱ͖Δέʔε͸ݶఆత w 6*,JUͰ͸7JFX.PEFMʹج͍ͮͯςΩετͷ৭Λมߋ͢Δͱ͍͏ॲ ཧΛએݴతʹ͸ॻ͚ͳ͍ w 4XJGU6*͕ରԠ͢Δએݴతͳ࣮૷͸Ϧετʹݶఆ͞Εͳ͍ w

    4XJGU6*͸ίϯϙʔωϯτͷ࣮૷͕༰қͰ͋Δ w 7JFX$POUSPMMFSͱൺֱͯ͠ɺ7JFXͱ7JFX.PEFMͷૄʹͳΔ w 7JFX ίϯϙʔωϯτ ͷ࠶ར༻ੑ͕ͱͯ΋ߴ͍ w 6*,JUͱൺֱͯ͠ɺίϯϙʔωϯτԽ͢ΔͨΊʹಛघͳ࣮૷͕ෆཁ w ී௨ʹ࣮૷͍ͯ͘͠ͱίϯϙʔωϯτʹͳΔ