5000行のUITableViewを差分更新する / Difference update UITableView with 5000 rows

9bda8755a689204677a198ee85c0eb07?s=47 banjun
September 01, 2018

5000行のUITableViewを差分更新する / Difference update UITableView with 5000 rows

iOSDC Japan 2018s
2018/09/01 14:20〜 Track A レギュラートーク(30分)

CfP: https://fortee.jp/iosdc-japan-2018/proposal/530b6839-cc50-452c-9682-897afa9db18c

YouTube Archive: TBA

9bda8755a689204677a198ee85c0eb07?s=128

banjun

September 01, 2018
Tweet

Transcript

  1. 18.

    ࠩ෼ߋ৽͍ΕͯΈͨ private var filteredSections: [Section] = [] { didSet {

    tableView.animateRowAndSectionChanges( oldData: oldValue, newData: filteredSections) } }
  2. 32.

    $PMMFDUJPOJOEFY struct Section<Item: Equatable>: 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)} }
  3. 33.

    $PMMFDUJPOJOEFY ruct Section<Item: Equatable>: Collection { var header: String? var

    items: [Item] // Diffable var diffIdentifier: AnyHashable // Collection
  4. 37.

    $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
  5. 39.

    4FDUJPO*UFN&RVBUBCMF struct Section<Item: Equatable>: 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)} }
  6. 57.