いまから使える SpreadsheetView

いまから使える SpreadsheetView

5eee847529e8f5ec2f634a85075fd5aa?s=128

Satoshi Hachiya

May 24, 2017
Tweet

Transcript

  1. ͍·͔Β࢖͑Δ SpreadsheetView potatotips #40 at Retty Wednesday May 24th 2017

  2. Satoshi Hachiya Twitter: @jpmartha_jp • ฌݿݝਆށࢢࡏॅ • iOS ΤϯδχΞ /

    ίϛϡχςΟӡӦ • ౦ژͰ ʮPlayer!ʯͷ։ൃ • ࠃࡍΧϯϑΝϨϯεʮtry! Swift Tokyoʯɺʮtry! Swift NYCʯͳͲ
  3. kishikawakatsumi/SpreadsheetView • ެ։ޙ 13 ೔Ͱ໿ 1,500 ελʔ֫ಘ ✨ • ͬͦ͘͞εέδϡʔϧදΛ࡞ͬͯΈ·ͨ͠

    "
  4. ࠓճ࡞ͬͨ؆қΞϓϦ ʢ৭࢖͍͸๻ͷηϯεͰ͢ !ʣ

  5. Features (1/3) • Fixed column and row headers • ϔομݻఆ

    • Merge cells • ηϧͷ݁߹
  6. Features (2/3) • Circular infinite scrolling automatically • ॥؀εΫϩʔϧ •

    Customize gridlines and borders for each cell • άϦουઢͱ࿮ઢͷΧελϚΠζ • Customize inter cell spacing vertically and horizontally • ಺ଆͷ༨നͷΧελϚΠζ
  7. Features (3/3) • Fast scrolling, memory efficient • UICollectionView like

    API • Well unit tested
  8. ͋͞࢖ͬͯΈΑ͏ ✊

  9. 3 ͭͷαϯϓϧ෇͖ • εέδϡʔϧ • Ψϯτνϟʔτ • λΠϜςʔϒϧ

  10. UICollectionView ͷΑ͏ͳ API func numberOfColumns(in spreadsheetView: SpreadsheetView) -> Int func

    numberOfRows(in spreadsheetView: SpreadsheetView) -> Int func spreadsheetView(_ spreadsheetView: SpreadsheetView, cellForItemAt indexPath: IndexPath) -> Cell?
  11. Merge cells

  12. Θ͔Γ΍͍͢Α͏୯७ʹ͠·ͨ͠ func mergedCells(in spreadsheetView: SpreadsheetView) -> [CellRange] { return [

    CellRange(from: (row: 0, column: 1), to: (row: 0, column: 2)), CellRange(from: (row: 0, column: 3), to: (row: 0, column: 4)), CellRange(from: (row: 2, column: 0), to: (row: 13, column: 0)), CellRange(from: (row: 14, column: 0), to: (row: 25, column: 0)), CellRange(from: (row: 26, column: 0), to: (row: 37, column: 0)), CellRange(from: (row: 38, column: 0), to: (row: 49, column: 0)), CellRange(from: (row: 50, column: 0), to: (row: 61, column: 0)), CellRange(from: (row: 62, column: 0), to: (row: 73, column: 0)), CellRange(from: (row: 74, column: 0), to: (row: 85, column: 0)), CellRange(from: (row: 86, column: 0), to: (row: 97, column: 0)), CellRange(from: (row: 98, column: 0), to: (row: 109, column: 0)), CellRange(from: (row: 110, column: 0), to: (row: 121, column: 0)), CellRange(from: (row: 122, column: 0), to: (row: 133, column: 0)), CellRange(from: (row: 8, column: 1), to: (row: 22, column: 1)), CellRange(from: (row: 23, column: 1), to: (row: 25, column: 1)) ] }
  13. 5෼ࠁΈͷηϧΛ࡞ͬͯ݁߹ͤ͞·ͨ͠ !

  14. ͯ͞ ΄͔ʹϥΠϒϥϦ͸ʁ !

  15. Repository Latest commit Fixed column and row headers Merge cells

    Star kishikawakatsumi /SpreadsheetView 2017 ✅ ✅ 1,478 stuffrabbit/ SwiftSpreadsheet 2017 ✅ 379 mutualmobile/ MMSpreadsheetVi ew 2013 ✅ 171 darrarski/ DRCollectionView TableLayout-iOS 2015 ✅ 67 ʢ! ௐ΂ʣ
  16. !

  17. ࠷ޙʹʢ·ͩ۷ΓԼ͍͛ͨ಺༰ʣ • Fast scrolling, memory efficient • Well unit tested

  18. ͻͱ͚ͭͩྫΛڍ͛Δͱ Binary Searchʢೋ෼୳ࡧʣ

  19. raywenderlich/swift-algorithm-club ʹΑΔͱɺ The built-in indexOf() function performs a linear search.

  20. ͋Γ͕ͱ͏͍͟͝·ͨ͠!