Slide 1

Slide 1 text

͹Μ͡ΎΜ!CBOKVO J04%$+BQBO ߦͷ6*5BCMF7JFXΛࠩ෼ߋ৽͢Δ

Slide 2

Slide 2 text

͹Μ͡ΎΜ!CBOKVO ࣗݾ঺հ 'MJDL4,,4,,ΩʔϘʔυ J04 -PWF-JWFSϥΠϒϑΥτੜ੒ NBD04 1IPUP4UVEJP1MBZFS
 ϥΠτχϯάΫϩϚΩʔΩϟϓνϟ NBD04 
 ΞΠϚεϋοΧιϯɾϓϦοΧιϯ NBD04ʙ ͱ͔

Slide 3

Slide 3 text

͓͠͝ͱ ͋ΒΏΔϞϊͷ؅ཧΛࢧԉ͢ΔΫϥ΢υαʔϏε ୨Է͠ ିग़͠ 1PDLFU

Slide 4

Slide 4 text

https://nrstudy.connpass.com ΋͘΋͘ձ΍ͬͯ·͢ ฏ೔໷ ݄

Slide 5

Slide 5 text

ࠓ೔࿩͢͜ͱ ୈ̍෦
 6*5BCMF7JFXͰࠩ෼ߋ৽ ୈ̎෦
 ύϑΥʔϚϯεղੳ

Slide 6

Slide 6 text

ࠓ೔࿩͢͜ͱ "5BCMF7JFXࠩ෼ߋ৽΍ͬͯΔ "6*ͷࠩ෼ߋ৽ͬͯͲΜͳ΋ͷ͔஌ͬͯΔ 
 ࡢ೔ͷࠩ෼ߋ৽ͷ࿩͖͍ͨ ͦͷલʹɾɾɾ͢͜͠Ξϯέʔτ

Slide 7

Slide 7 text

6*5BCMF7JFXͰࠩ෼ߋ৽Λ࢖͓͏ ୈ̍෦

Slide 8

Slide 8 text

6*5BCMF7JFX ߦ਺͕ͨ͘͞Μʹͳͬͯ΋଎͍ 6*7JFXγϦʔζͷͳ͔Ͱ͍ͪ͹Μ޷͖

Slide 9

Slide 9 text

6*5BCMF7JFXͷߋ৽खஈ શ෦ߋ৽ ࠩ෼ߋ৽ reloadData() deleteRows(at:with:) insertRows(at:with:) ʹ࢖͑Δϝιου [IndexPath] ͔ΜͨΜʂ Ξχϝʔγϣϯͳ͠ʂ ͍ͨ΁Μ

Slide 10

Slide 10 text

reloadData() શ෦ߋ৽ ࠩ෼ߋ৽ deleteRows(at:with:) insertRows(at:with:)

Slide 11

Slide 11 text

ࠩ෼ߋ৽ΛͲ͏࣮ݱ͢Δ͔ ࠩ෼ͷ[IndexPath]Λৗʹਖ਼֬ʹࢦఆ͢Δ͚ͩɾɾɾ ࡟আૢ࡞ͨ͠ߦ
 ϑΟϧλʔͰফ͑ͨߦ
 ϑΟϧλʔղআͰ࠶౓දࣔ͢Δߦ ߋ৽લޙͷσʔλͷEJGGΛऔΕΔͳΒɺ΋ͬͱͣͬͱ؆୯ʹͳΔ

Slide 12

Slide 12 text

ࠩ෼ߋ৽ΛͲ͏࣮ݱ͢Δ͔ ࠩ෼ͷ[IndexPath]Λৗʹਖ਼֬ʹࢦఆ͢Δ͚ͩɾɾɾ ࡟আૢ࡞ͨ͠ߦ
 ϑΟϧλʔͰফ͑ͨߦ
 ϑΟϧλʔղআͰ࠶౓දࣔ͢Δߦ EJGGΛ࢖͓͏ લޙͷσʔλΛΈͯɺEJGGͰ<*OEFY1BUI>ग़͢

Slide 13

Slide 13 text

EJ⒎ͱQBUDIBQQMZ insertRows(…) deleteRows(…) EJGG QBUDIBQQMZ old new ❌ ❌ ❌ + %BUB4PVSDF

Slide 14

Slide 14 text

ࠩ෼ߋ৽͸͕͍͍͜͜ ΩϨΠͰ෼͔Γ΍͍͢Ξχϝʔγϣϯ σʔλૢ࡞Ͱ*OEFY1BUIΛؾʹ͠ͳ͍ͰࡁΉ

Slide 15

Slide 15 text

طଘΞϓϦࠩ෼ߋ৽ ଟ਺ߦΛѻ͏طଘΞϓϦ΋ɺ
 ͦΖͦΖࠩ෼ߋ৽ʹͯ͠ɺ
 ָͯ͠ΩϨΠʹΞχϝʔγϣϯ͍ͨ͠ʂʂʂ

Slide 16

Slide 16 text

طଘΞϓϦ˞Πϝʔδ ฤूͰ͖Δ
 ը໘ ௥ՃͰ͖Δ
 ը໘

Slide 17

Slide 17 text

ࠩ෼ߋ৽͍ΕͯΈͨ private var filteredSections: [Section] = [] { didSet { tableView.reloadData() } }

Slide 18

Slide 18 text

ࠩ෼ߋ৽͍ΕͯΈͨ private var filteredSections: [Section] = [] { didSet { tableView.animateRowAndSectionChanges( oldData: oldValue, newData: filteredSections) } }

Slide 19

Slide 19 text

ߦͰ࡟আͱϑΟϧλʔ ಛʹϑΟϧλʔ஗͗͢ͳ͍ɾɾɾ P0 ͖ͬ͞ͷ͸ເͩͬͨͷ͔ ࠩ෼ߋ৽͍ΕͯΈͨ

Slide 20

Slide 20 text

SFMPBE%BUBͷ΄͏͕Ϛγ ʜͱݴΘΕͳ͍ͨΊʹ

Slide 21

Slide 21 text

ύϑΥʔϚϯεղੳ͠Α͏ ୈ̎෦

Slide 22

Slide 22 text

ύϑΥʔϚϯεղੳ͠Α͏ " " # /4-PH $ צ

Slide 23

Slide 23 text

ύϑΥʔϚϯεղੳ͠Α͏ ܭଌͰ͖ͳ͍΋ͷ͸վળͰ͖ͳ͍

Slide 24

Slide 24 text

5JNF1SPpMFSΛ͔ͭ͏

Slide 25

Slide 25 text

5JNF1SPpMFSͰΘ͔Δ͜ͱ ΞϓϦ࣮ߦதͷ$16ෛՙͷ࣌ܥྻͷάϥϑ ֤εϨουͰɺͲͷఔ౓ͷෛՙ͕͔͋ͬͨ ελοΫτϨʔεͷ֤ஈͷෛՙ ͔͔ͬͨ࣌ؒ

Slide 26

Slide 26 text

5JNF1SPpMFSͰΘ͔Δ͜ͱ ΞϓϦ࣮ߦதͷ$16ෛՙͷ࣌ܥྻͷάϥϑ ֤εϨουͰɺͲͷఔ౓ͷෛՙ͕͔͋ͬͨ ελοΫτϨʔεͷ֤ஈͷෛՙ ͔͔ͬͨ࣌ؒ

Slide 27

Slide 27 text

5JNF1SPpMFSͰΘ͔Δ͜ͱ ΞϓϦ࣮ߦதͷ$16ෛՙͷ࣌ܥྻͷάϥϑ ֤εϨουͰɺͲͷఔ౓ͷෛՙ͕͔͋ͬͨ ελοΫτϨʔεͷ֤ஈͷෛՙ ͔͔ͬͨ࣌ؒ

Slide 28

Slide 28 text

ߋ৽׬ྃ·Ͱͷ߹ܭ࣌ؒ UPUBMT EJGG QBUDI ˞3FMFBTFCVJME ߦˠߦ

Slide 29

Slide 29 text

ߋ৽׬ྃ·Ͱ վྑޙ UPUBMT EJGG QBUDI ˞τϨʔυΦϑ͋Γ ߦˠߦ

Slide 30

Slide 30 text

ͲΕ͘Β͍ɺ஗͍ ׈Β͔ͳΞχϝʔγϣϯ GQT T
 'JSFCBTFͷʮ஗͍ϨϯμϦϯάʯT ͕Ҏ্ 'JSFCBTFͷʮϑϦʔζͨ͠ϑϨʔϜʯT ͕Ҏ্ T T ͜ͷ͋ͨΓʹऩΊ͍ͨ

Slide 31

Slide 31 text

ࠩ෼ߋ৽ϥΠϒϥϦ ػೳɾ଎౓ɾطଘઃܭ΁ͷӨڹ౓͕ҟͳΔ %XJGGUʜɹɹߦن໛Ͱ͸ϝϞϦ֬อͰ͖ͳ͍ %JGGFSʜɹɹEJGG଎౓͕΍΍஗͍ )FDLFM%JGG %FFQ%JGG %BUB4PVSDFT 3Y%BUB4PVSDFT ϚϧνηΫγϣϯඇରԠ ઃܭมߋ͕ඞཁ

Slide 32

Slide 32 text

$PMMFDUJPOJOEFY struct Section: Collection { var header: String? var items: [Item] // Diffable var diffIdentifier: AnyHashable // Collection var startIndex: Int {return items.startIndex} var endIndex: Int {return items.endIndex} subscript(position: Int) -> Item {return items[position]} func index(after i: Int) -> Int {return items.index(after: i)} }

Slide 33

Slide 33 text

$PMMFDUJPOJOEFY ruct Section: Collection { var header: String? var items: [Item] // Diffable var diffIdentifier: AnyHashable // Collection

Slide 34

Slide 34 text

$16΄΅ͰT௒͑ $PMMFDUJPOJOEFY

Slide 35

Slide 35 text

*OTUSVNFOUTجຊίϚϯυ ➡ɹ⬇ɹ➡ɹ⬇ɹ➡ɹ⬇ɹ➡ɹ⬇ɹ $PMMFDUJPOJOEFY

Slide 36

Slide 36 text

JOEFYऔಘʹNJOɾɾɾ⁉ $PMMFDUJPOJOEFY

Slide 37

Slide 37 text

$PMMFDUJPOJOEFYͷܭࢉྔ JOEFY͸3BOEPN"DDFTT$PMMFDUJPOͳΒఆ਺࣌ؒ0 
 ͦ͏Ͱͳ͚Ε͹ઢܗ࣌ؒ0 / /// - Complexity: O(1) if the collection conforms to /// `RandomAccessCollection`; otherwise, O(*k*), where *k* is the absolute /// value of `distance`. func index(_ i: Index, offsetBy distance: Int) -> Index swift/stdlib/public/core/Collection.swift

Slide 38

Slide 38 text

3BOEPN"DDFTT$PMMFDUJPOΛ࢖͓͏ ˠUPUBMTऑʹͳΔ ͍͍ͩͨഒߴ଎Խ extension Section: RandomAccessCollection {}

Slide 39

Slide 39 text

4FDUJPO*UFN&RVBUBCMF struct Section: RandomAccessCollection { var header: String? var items: [Item] // Diffable var diffIdentifier: AnyHashable // Collection var startIndex: Int {return items.startIndex} var endIndex: Int {return items.endIndex} subscript(position: Int) -> Item {return items[position]} func index(after i: Int) -> Int {return items.index(after: i)} }

Slide 40

Slide 40 text

$PMMFDUJPO@GBJM&BSMZ3BOHF$IFDLͰ ➡ɹ⬇ɹ➡ɹ⬇ɹ➡TXJGU@HFU(FOFSJD.FUBEBUB 4FDUJPO*UFN&RVBUBCMF

Slide 41

Slide 41 text

$PMMFDUJPO@GBJM&BSMZ3BOHF$IFDLͰ ➡ɹ⬇ɹ➡ɹ⬇ɹ➡TXJGU@HFU(FOFSJD.FUBEBUB 4FDUJPO*UFN&RVBUBCMF

Slide 42

Slide 42 text

(FOFSJDTΛআڈ͠Α͏ ˠUPUBMTʹͳΔ ͍͍ͩͨഒߴ଎Խ @GBJM&BSMZ3BOHF$IFDL͸ؙ͝ͱফ͑Δ ಾ struct Section: RandomAccessCollection {

Slide 43

Slide 43 text

QBUDIBQQMZ ͜Ε·Ͱͷख๏ͰɺQBUDIͷ࣌ؒ͸มԽ͠ͳ͍ T T T ߦ਺มԽ T T ख๏ Gen Rnd Gen Rnd Gen Rnd Gen Rnd

Slide 44

Slide 44 text

QBUDIBQQMZ ͜Ε·Ͱͷख๏ͰɺQBUDIͷ࣌ؒ͸มԽ͠ͳ͍ ߦ ਺ ม Խ ผ ͷ EJGG
 ϥΠ ϒϥ Ϧ

Slide 45

Slide 45 text

࡟আΞχϝʔγϣϯੜ੒ @TFUVQ"OJNBUJPOT'PS%FMFUFE$FMMT͕ϘτϧωοΫʹͳΓ͕ͪ ΞχϝʔγϣϯແޮԽͰ͸ޮՌ͕ͳ͍ ❌QFSGPSN8JUIPVU"OJNBUJPO❌EJTBCMF"DUJPOT

Slide 46

Slide 46 text

࡟আΞχϝʔγϣϯੜ੒ @TFUVQ"OJNBUJPOT'PS%FMFUFE$FMMT͕ϘτϧωοΫʹͳΓ͕ͪ ΞχϝʔγϣϯແޮԽͰ͸ޮՌ͕ͳ͍ ❌QFSGPSN8JUIPVU"OJNBUJPO❌EJTBCMF"DUJPOT

Slide 47

Slide 47 text

ૠೖ਺࡟আ਺ ૠೖ਺͸૿͑ͯ΋଎౓ʹ Өڹ͠ͳ͍ ࡟আ਺͕૿͑Δͱ஗͍ ߦʙΛѻ͏ͷ͸
 ͦ΋ͦ΋ݫ͍͠

Slide 48

Slide 48 text

SFMPBE%BUBͷ΄͏͕ྑ͍ͷͰ͸ ʜͦ͏͍͏ʮͱ͖ʯ΋͋Δ

Slide 49

Slide 49 text

ࠩ෼ߋ৽ͱଟ਺ߦ࡟আͷڞଘ ΄ͱΜͲͷࠩ෼ߋ৽ϥΠϒϥϦʹద༻Մೳ JOUFSSVQUΫϩʔδϟͰ෼ذͰ͖ΔϥΠϒϥϦ΋͋Δ EJGG QBUDIBQQMZ SFMPBE%BUB ଟ਺࡟আ

Slide 50

Slide 50 text

ࠩ෼ߋ৽ͱଟ਺ߦ࡟আͷڞଘ ಘΔ΋ͷ ᮢ஋Λ௒͑ͨͱ͖ͷ QBUDIͷ଎౓T ഒߴ଎Խ ˰UPUBMT ഒߴ଎Խ ࣦͳ͏΋ͷ ᮢ஋Λ௒͑ͨͱ͖ͷ Ξχϝʔγϣϯ

Slide 51

Slide 51 text

࣍ͷεςοϓ "࠷ѱϛϦඵͳΒ0,ͱ͢Δ #EJGGΛ΋ͬͱ଎͘͢Δ $ϑΥʔϧόοΫͷӨڹΛݮΒ͢ ͦ͏͍͏ϥΠϒϥϦ͕
 ͋Ε͹ʜ

Slide 52

Slide 52 text

EJ⒎Λ΋ͬͱ଎͘͢Δ %JGGFSͷEJGGΑΓ)FDLFMΞϧΰϦζϜ͕଎͍ͷ͸෼͔͍ͬͯΔ ϚϧνηΫγϣϯͷѻ͍͸஫ҙ ࠩ෼ߋ৽ͭ͘ΔͳΒʜ

Slide 53

Slide 53 text

ϑΥʔϧόοΫͷӨڹΛݮΒ͢ ςʔϒϧશମͰʮࠩ෼ߋ৽PSreloadDataʯ ΑΓ΋ ηΫγϣϯ͝ͱʹʮࠩ෼ߋ৽PSreloadSectionsʯ ଟ਺࡟আͷηΫγϣϯʹר͖ࠐ·Εͣࠩ෼ߋ৽Ͱ͖Δ ͜Ε΋஗͘ͳΒͳ͍

Slide 54

Slide 54 text

ηΫγϣϯ͝ͱʹSFMPBEGBMMCBDL͢Δ
 ࠩ෼ߋ৽ϥΠϒϥϦ ҆қʹGBMMCBDL͢Δίϯηϓτ࣮૷CBOKVO#JH%JGGFS ηΫγϣϯ͝ͱʹEJGG ηΫγϣϯ·͕ͨͳ͍ ߋ৽લʹදࣔ͞Ε͍ͯͳ͍ηΫγϣϯ͸SFMPBE4FDUJPOT -JTU%JGGͰEJGGܭࢉ )FDLFM ଟ਺࡟আ͕͋ΔͳΒSFMPBE4FDUJPOT

Slide 55

Slide 55 text

ߋ৽׬ྃ·Ͱ վྑޙ UPUBMT EJGG QBUDI ߦˠߦ EJGG QBUDI ߦˠߦ UPUBMT

Slide 56

Slide 56 text

·ͱΊ ࠩ෼ߋ৽͸Ξχϝʔγϣϯ΋ϩδοΫ΋ΩϨΠ كʹɺ͘͢͝஗͍έʔε͕͋ΔͷͰ஫ҙ ਺ߦͷ௥Ճ࡟আ͚ͩͰ͸ͳ͘ʮ΄ͱΜͲ࡟আʯ΋ݟ͓ͯ͜͏ EJGGΛ଎͘ɺQBUDIBQQMZΛ஗ͤͣ͘ɺշదͳࠩ෼ߋ৽

Slide 57

Slide 57 text

No content