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

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

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

ばんじゅん🍓

September 01, 2018
Tweet

More Decks by ばんじゅん🍓

Other Decks in Technology

Transcript

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

    tableView.animateRowAndSectionChanges( oldData: oldValue, newData: filteredSections) } }
  2. $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. $PMMFDUJPOJOEFY ruct Section<Item: Equatable>: Collection { var header: String? var

    items: [Item] // Diffable var diffIdentifier: AnyHashable // Collection
  4. $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. 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)} }