ReactiveProperty を使ったアプリの設計に Realm Xamarin を組み合わせる

ReactiveProperty を使ったアプリの設計に Realm Xamarin を組み合わせる

2017/03/19 Realm World Tour
Demo Project: https://github.com/iseebi/RP-CleanArchitecture-Demo

619fccc61ef955ccf39bfa41df527042?s=128

Nobuhiro Ito

March 19, 2017
Tweet

Transcript

  1. 3FBDUJWF1SPQFSUZΛ࢖ͬͨΞϓϦͷઃܭʹ 3FBMN9BNBSJOΛ૊Έ߹ΘͤͯΈͨ /PCVIJSP*UP

  2. ࣗݾ঺հ w ҏ౻৳༟ w ϑΣϯϦϧגࣜձࣾΞϓϦέʔγϣϯڞಉ։ൃ෦νʔϑΤϯδχΞ w ݉ɹ৽نࣄۀ෦#PMU[&OHJOFϓϩμΫτΦʔφʔ w ओʹεϚʔτϑΥϯΞϓϦͷઃܭɾ։ൃΛ୲౰ɻ࠷ۙ͸Ϛωʔδϝϯτ΋ɻ w

    J04 4XJGU 0CKFDUJWF$ "OESPJE +BWB 9BNBSJO $
  3. None
  4. 9BNBSJO w $ͰJ04"OESPJE.BDͷ։ൃ͕Ͱ͖ΔπʔϧΩοτ w ࡢ೥.JDSPTPGU͕ങऩͯ͠ɺݸਓ޲͚ʹແঈԽ w ๏ਓ޲͚΋೥ؒສਓˠສԁͪΐ͍ʹ
 9BNBSJO.BD΋7JTVBM4UVEJP΋ɺ8JOEPXT΋͍ͭͯ͘Δ  w

    ೔ຊͷϢʔβʔάϧʔϓͱͯ͠
 +BQBO9BNBSJO6TFS(SPVQ +96( ͕͋Δ
  5. 9BNBSJOΛ࢖ͬͨ։ൃख๏ 9BNBSJO'PSNT 9BNBSJO/BUJWF

  6. %FNP

  7. σϞͷཁࢫ w Ұཡදࣔɾ௥Ճɾৄࡉද͔ࣔΒͳΔ؆୯ͳΞϓϦ w σʔλϕʔε͸΋ͪΖΜ3FBMNΛ࢖༻ɻ w 3FBMN0CKFDU4FSWFSͰಉظɻ w ݩωλ͸$POOFDU ͱ͍͏ΦϯϥΠϯΠϕϯτͰͷɺ


    .JHVFMEF*DB[BͷσϞ ͜ͷͱ͖͸"[VSF"QQ4FSWJDF͕όοΫΤϯυͩͬͨ
  8. ͋ΔΞϓϦͷڞ௨Խʴߏ଄Խͷྺ࢙ ୈ̍ੈ୅ ωΠςΟϒʴ4JOHMFUPOͳ.BOBHFS͕͍͔ͭ͘ɻ ୹ظؒूதܕͷνʔϜ։ൃʹ͸޲͔ͳ͔ͬͨɻ ୈ̎ੈ୅ 9BNBSJO .WWN$SPTTʹΑΔڞ௨Խ 7JFXͷ෼཭͸Ͱ͖͕ͨڞ௨෦ʹΰουΫϥεग़ݱ ୈ̏ੈ୅ $MFBO"SDIJUFDUVSFΛج࣠ʹڞ௨෦෼཭ڧԽ

    ૚ͷ໾ׂΛ໌֬ʹͯ͠ݟ௨͠ޮ͖΍ͨ͘͢͠
  9. $MFBO"SDIJUFDUVSF w υϝΠϯۦಈ։ൃ %%% ͳͲΛҙࣝͯ͠ɺ
 ϏδωεϩδοΫΛ૚ʹ෼͚ͯ໾ׂͱ੹೚Λ෼ׂ͢Δख๏ w ʮ.77.ͰϞσϧͱϏϡʔͷ੹຿Λʙʯͱ͍͏࿩͸ଟ͔͕ͬͨɺ
 ʮ͡Ό͋ͦͷϞσϧͲͳ͍͢ΜͶΜʯͱ͍͏෦෼ʹର͢ΔղͷҰͭ
 ͱೝ͍ࣝͯ͠Δ

     w .77.͚ͩͰ͸$PSF͕ਏ͘ͳΔ໰୊ΛղফͰ͖ͳ͍
  10. 7JFX 1SFTFOUFS 6TF$BTF 5SBOTMBUPS .PEFM %BUB4UPSF &OUJUZ 3FQPTJUPSZ IUUQRJJUBDPNLPVUBMPVJUFNTBGDGBEFDED

  11. 7JFX 1SFTFOUFS 6TF$BTF 5SBOTMBUPS .PEFM %BUB4UPSF &OUJUZ 3FQPTJUPSZ IUUQRJJUBDPNLPVUBMPVJUFNTBGDGBEFDED ը໘දࣔɾΠϕϯτͷ1SFTFOUFS΁ͷ௨஌

    7JFXͱ6TF$BTFͷؒͰͷσʔλ΍ΓͱΓ ඞཁͳϩδοΫΛॻ͘ͱ͜ΖɻσʔλͷऔಘͳͲɻ 3FQPTJUPSZ͔Βग़͖ͯͨ&OUJUZΛ.PEFMʹม׵͢Δ 7JFXͰ࢖༻͢ΔͨΊʹ࠷దԽͨ͠σʔλϞσϧ υϝΠϯ૚ͱσʔλ૚ͷ*' 6TF$BTFͰ࢖༻͢Δσʔλͷ$36%ॲཧΛ୲౰ σʔλΛ࣮ࡍʹऔಘߋ৽͢Δ σʔλ૚Ͱ࢖༻͢ΔσʔλϞσϧ
  12. ͏Ε͘͠ͳ͍఺ w Ϋϥεଟ͗͢ .PEFMͱ&OUJUZΘ͟Θ͟ม׵͢Δඞཁ͋Δʁ  w ࣅͨΑ͏ͳ΋ͷ͸΋͏গ͠஌ͬͯΔ໊લʹͰ͖ͳ͍͔ʁ
 1SFTFOUFSͬͯ.77.Ͱ͍͏ͱ͜Ζͷ7JFX.PEFMΑͶʁ  w

    ը໘ʹ͔͔ΘΒͣมԽ͢Δ஋ͷัଊΛͲ͏͢Δʁ
 8FC4PDLFU΍ϙʔϦϯάͰ؀ڥ֎͔ΒมԽ͢Δ஋ଟ਺
  13. ॏཁͳͷ͸੍ޚͷํ޲ΛҰఆʹ͢Δ͜ͱ ΫϥεΛ෼ׂ͠·͘Δͷ͸ຊ࣭͡Όͳ͍͸ͣ

  14. 7JFX 1SFTFOUFS 6TF$BTF 5SBOTMBUPS .PEFM %BUB4UPSF &OUJUZ 3FQPTJUPSZ ࠓճΘ͟Θ͟ม׵͢Δ ඞཁ͸ͳͦ͞͏

  15. 7JFX 1SFTFOUFS 6TF$BTF %BUB4UPSF &OUJUZ 3FQPTJUPSZ 4FSWJDF όοΫάϥ΢ϯυ͔Β஋Λม͑Δॲཧ )551ϙʔϦϯάɺ8FC4PDLFUͰͷมԽ 

    %BUB4UPSFΛ௚઀ૢ࡞͢Δ͜ͱʹͨ͠ ˞"OESPJEଆͰ*OUFOU4FSWJDFͱ͔ͱ͔ͿΔ͔Β8PSLFSʹ͢΂͖ͩͬͨ
  16. 7JFX 7JFX.PEFM 4DFOF %BUB4UPSF .PEFM 3FQPTJUPSZ 4FSWJDF ͜Ε·Ͱݟ֮͑ͷ͋Δ໊લʹม͑ͨ ɾ1SFTFOUFS͸͜Ε·Ͱͷ7JFX.PEFM૬౰ͷಈ͖ ɾ&OUJUZ͸͜Ε·Ͱͷ.PEFM૬౰ͷಈ͖

    ɹ 7JFXҎ্΋͜ΕΛͦͷ··ར༻͢Δ  ɾ6TF$BTF͸࢖͍͍ͬͯϫʔυ͔ͪΐͬͱࣗ৴ͳ͔ͬͨ ɹͷͰɺ৽͘͠4DFOF໊ͬͯલΛ͚ͭͨ
  17. 7JFX 7JFX.PEFM 4DFOF %BUB4UPSF .PEFM 3FQPTJUPSZ 4FSWJDF ͜ͷ෦෼͕1$- ڞ௨ίʔυ

  18. ૚ͷؒͷ઀ଓ w ͢΂ͯ3FBDUJWF1SPQFSUZͰܨ͍Ͱ͍Δɻ w IUUQTHJUIVCDPNSVODFFM3FBDUJWF1SPQFSUZ w !PLB[VLJ͞Μ࡞ɻ
 ϓϩύςΟΛ3FBDUJWF&YUFOTJPOͱଊ͑ͯૢ࡞Ͱ͖ΔΑ͏ʹͳΔɻ w ຊདྷ͸7JFX.PEFM7JFXؒͰ࢖͏΂͖ͱҰ෦ͰݴΘΕ͍ͯΔ͕ɺ


    ϓϩύςΟͱ͍͏ϝλϑΝ͕Θ͔Γ΍͍͢ͷͰ͢΂ͯͷ૚Ͱར༻ɻ
  19. 3FBDUJWF1SPQFSUZͷΑ͍ͱ͜Ζ w 31ʹ஋Ληοτ͢Δͱ3YετϦʔϜʹ஋͕ྲྀΕΔ Θ͔Γ΍͍͢  w *0CTFSWBCMF5ΛͳΜͰ΋3FBDUJWF1SPQFSUZʹͰ͖Δ 5P3FBDUJWF1SPQFSUZ ศར 

    w 3FBDUJWF1SPQFSUZ4FMFDU YBOZ 5P3FBDUJWF1SPQFSUZ ͱ͍͏ͷ΋Մೳ w ͦͷ··7JFXΦϒδΣΫτʹόΠϯσΟϯάͰ͖Δ 4FU#JOEJOH  w J04ͷࠓͷόʔδϣϯ͸յΕ͍ͯΔ मਖ਼13ϚʔδࡁΈ
  20. 7JFX 7JFX.PEFM 4DFOF %BUB4UPSF .PEFM 3FQPTJUPSZ 4FSWJDF %BUB4UPSFΛ࠷Լ૚ͱͯ͠ Լ૚ͷ3FBDUJWF1SPQFSUZΛ ্૚͔Β4VCTDSJCF͢Δ

    Լ૚ͷ஋Λ্૚ʹఏڙ͢Δ΋ͷ͸5P3FBDUJWF1SPQFSUZ͢Δ ͜ͷਤͰ͸ 4FSWJDF͚ͩ͸ٯͳͷͰ஫ҙ
  21. ֤૚ͷߟ͑ํ%BUB4UPSF w σʔλϕʔεΛ௚઀৮ͬͯྑ͍ϨΠϠʔ w ࣮ࡍͷΞϓϦͰ͸ҎԼͷΑ͏ͳ΋ͷΛ༻ҙͨ͠ ࠓճͷσϞʹ͸ؚ·ͣ  w &QIFNFSBM%BUB4UPSFىಈ࣌ʹ"1*͔Βऔಘ͢ΔҰ࣌తσʔλΛอ࣋ w

    "QJ%BUB4UPSF"1*ͱ௨৴ͯ͠σʔλΛऔΔ w 4UPSFE%BUB4UPSFϑΝΠϧͰμ΢ϯϩʔυͨ͠ϦετσʔλΛอ࣋
  22. ֤૚ͷߟ͑ํ4FSWJDF w ௚઀%BUB4UPSFͷ஋Λѻͬͯߋ৽͢Δɻ ࠓճͷσϞʹ͸ؚ·ͣ  w λΠϚʔͰҰఆ͓͖࣌ؒʹ"QJ%BUB4UPSF͔Β஋Λऔ͖ͬͯͯɺ
 &QIFNFSBM%BUB4UPSFʹॻ͖ࠐΉͳͲɻ

  23. ֤૚ͷߟ͑ํ3FQPTJUPSZ w %BUB4UPSFͷ֤छૢ࡞Λߦ͍ɺ্ͷ૚ʹ஋Λఏڙ͢Δɻ w 3FBDUJWF1SPQFSUZ΍ϝιουΛ্ͷ૚ʹެ։ w ݁Ռతʹػೳ͝ͱʹ༻ҙ͞ΕΔ͜ͱͱͳͬͨɻ

  24. "OESPJEͷϦδϡʔϜରԠ w &QIFNFSBM%BUB4UPSFΛ0O4BWF*OTUBODF4UBUFͰ·Δͬͱอଘ
 ϦετΞ࣌ʹ·Δͬͱ෮ݩ w 3FBDUJWF1SPQFSUZͰͭͳ͕͍ͬͯΔ͔Β্ʹྲྀΕͯ͢΂ͯݩʹ໭Δ w 4UPSFE%BUB4UPSF͸εςʔτ͕ফ͑ͯ΋࠶ಡࠐͰ෮ݩ͞ΕΔ w ͜ͷϦδϡʔϜॲཧͷͨΊʹ"QQ4UBUF4FSWJDFͱ͍͏΋ͷΛ༻ҙͨ͠ɻ

  25. ֤૚ͷߟ͑ํ4DFOF w ಉ͡ػೳͷෳ਺ͷը໘Ͱڞ༗͞ΕΔػೳΛఏڙ͢Δɻ
 ݱஈ֊Ͱ͸஋ΛҰ࣌తʹอ࣋ͨ͠Γ΋͍ͯ͠Δ͕ɺ&QIFNFSBM%BUB4UPSF΁఻ୡ͞ΕΔ΂͖ 4DFOF

  26. ͜͜·Ͱͷ·ͱΊ w 3FBDUJWF1SPQFSUZΛ࢖͍ɺ$MFBO"SDIJUFDUVSFΛҙࣝͯ͠ઃܭͨ͠Βɺ
 ͦͦ͜͜͏·͍ͬͨ͘ײ͕͢͡Δ w ·ͩ͜Ε͕࠷దղͱ͸ࢥ͍ͬͯ·ͤΜͷͰɺ
 ࠓޙ΋ϒϥογϡΞοϓ͍ͯ͜͠͏ͱࢥ͍·͢ɻ

  27. 9BNBSJOϢʔβʔ͔ΒΈͨ 3FBMN

  28. ϥΠϒϥϦͷܗଶ w ωΠςΟϒόΠϯσΟϯάϥΠϒϥϦΛϥοϓ͍ͯ͠Δ༷ࢠ w #BJUBOE4XJUDIͰϥοϓ͞Ε͍ͯΔͷͰɺ
 ωΠςΟϒίʔυΛ࢖͑ͳ͍1$-͔Β΋ͦͷ··࢖͑Δɻ w 'PEZͱ͍͏/&5ͷதؒݴޠ .4*- Λมߋ͢Δπʔϧ͕࢖ΘΕ͍ͯΔɻ

    w Ϗϧυ࣌ɺ5PPMT3FBMN8FBWFS'PEZEMMͱϑΝΠϧ͕
 ιϦϡʔγϣϯσΟϨΫτϦʹੜ੒͞ΕΔ͕HJUJHOPSFͯ͠Α͍ɻ
  29. None
  30. ࢖͍ํ w 3FBMN(FU*OTUBODF ͰΠϯελϯεΛऔΔɻ w SFBMN"MM*UFN8IFSF ʜ ͱ͍ͬͨɺ
 $Ϣʔβʔʹ͸͓ͳ͡Έͷ-*/2ͰߜΓࠐΈՄೳ w

    ຤ඌʹ4FMFDUॻ͖ͨ͘ͳΔͷ͕͓໿ଋͰ͕͢ɺ
 ͦͷ··ͩͱ/PU*NQMFNFOUFE&YDFQUJPO͕ฦͬͯ͘ΔͷͰ
 Ұ౓5P-JTUͰྻڍ͢Δඞཁ͋Γɻ ύϑΥʔϚϯεɾ݅਺஫ҙ
  31. มߋ؂ࢹ Ϧετ w "T3FBMN$PMMFDUJPO͢Δͱ*3FBMN$PMMFDUJPO5͕औಘͰ͖ɺ */PUJGZ$PMMFDUJPO$IBOHFE5ͷΠϕϯτͰ؂ࢹͰ͖Δɻ w 3FBDUJWF1SPQFSUZͱͷ૬ޓӡ༻తʹ͸*3FBMN$PMMFDUJPO5ʹ
 5P3FBDUJWF$PMMFDUJPO͕΄͍͠ͱ͜Ζ ΍Ζ͏ͱͯ͠அ೦ ˞͜Ε͸͍ͩͿࡶͳͷͰ΋͏ͪΐͬͱߟ͑ͨํ͕͍͍

  32. มߋ؂ࢹ ಺༰ w 3FBMN0CKFDU͸*/PUJGZ1SPQFSUZ$IBOHFEΛఏڙ͍ͯ͠ΔͷͰɺ
 ͜ΕͰ؂ࢹ͢Δɻ w ͕ɺ3FBDUJWF1SPQFSUZΛ஌ͬͨࠓ͸͔ͳΓͭΒ͍ʜϥούʔ͕ඞཁ͔ɻ

  33. ॻ͖ࠐΈ w σʔλͷॻ͖ࠐΈ͸छྨ͋Δ w ϕʔγοΫͳͷ͸#FHJO8SJUFͰVTJOHϒϩοΫΛ࢖͏ w USBOTBDUJPO$PNNJU͞ΕΕ͹อଘɻ
 $PNNJU͞Εͣʹൈ͚Δͱ3PMMCBDL
 USBOTBDUJPO%JTQPTF 

    w VTJOH͏·͔ͭͬͯͯ͘DPPM
  34. ॻ͖ࠐΈ w ίϛοτલఏͰ͋Ε͹8SJUF "DUJPO3FBMN ͕ศརɻ
 όοΫάϥ΢ϯυͰ࣮ߦ͢Δ8SJUF"TZODΛBXBJU͢Δ͜ͱ΋Մɻ w தͰྫ֎͕ى͖ͳ͚Ε͹อଘ͞ΕΔ

  35. 3FBMN.PCJMF1MBUGPSN w 3FBMN(FU*OTUBODF ͷҾ਺ʹ$POpHVSBUJPO౉͚ͩ͢ͰରԠ׬ྃ w ͳʹ͜Ε௒ઈ؆୯͗͢Δʂʂʂײಈͨ͠ʂʂʂ w -PHJO"TZOD͕ฦͬͯ͘Δͷʹ͔͔࣌ؒΔΑ͏Ͱɺ
 ࢖͑Δ·Ͱʹ͔͔࣌ؒΔͷ͕೉఺ʁγϦΞϥΠζͯ͠ΩϟογϡͰ͖Δʁ
 ௐࠪෆ଍

  36. 3FBMN.PCJMF1MBUGPSN w 0CKFDU4FSWFS্ʹ֤ϢʔβʔͷSFBMNϑΝΠϧ͕͓͔Εͯɺ
 ඞཁʹԠͯ͡ڞ༗ઃఆ͕Մೳɺͱ͍͏ܗͰߟ͑Ε͹ྑ͍ͱཧղ͠·ͨ͠ɻ
 ͱͯ΋Θ͔Γ΍͍͢ʂ

  37. 3FBMN.PCJMF1MBUGPSN w ࣗࣾอ༗ͷαʔόʔʹઃஔ͢ΔϞσϧͳͷͰɺ
 σʔλΛ֎ʹग़ͤͳ͍େاۀͳͲͰ΋Αͦ͞͏ʜ w ͋Εɺ͜Ε͏ͪͷ੡඼Ͱ΋ಉ͡ࣄ͍ͬͯͨͳʜ

  38. 3FBMN9BNBSJOશମతͳײ૝ w -*/2 BTZODBXBJU 
 */PUJGZ$PMMFDUJPO$IBOHFE5 */PUJGZ1SPQFSUZ$IBOHFE5ͱ͍ͬͨɺ
 $Ϣʔβʔ͕ීஈ͔Β࢖͍ͬͯΔ΋ͷΛͪΌΜͱ࢖͑Δ w ֤छϥΠϒϥϦͱͷ૊Έ߹Θͤ΍͢͞΋͖ͬͱྑͦ͞͏ɻ


    3FBDUJWF1SPQFSUZͱ࿈ಈ͢ΔͨΊͷϥούʔͳͲ΋࡞ΒΕΔͱྑ͍ͳɻ w $PDPB΍+BWBʹൺ΂ͯߋ৽஗Ίͳͷ͕೉఺͔΋ɻ .BD 8JOEPXT΋·ͩ
  39. 9BNBSJO͸
 $ͷศརͰָ͍͠ϥΠϒϥϦ΋
 ͍ͬͺ͍͋ΔͷͰ
 ·ͩͷਓ͸Ұ౓৮ͬͯΈ·͠ΐ͏ʂ