πŸ’Ύ A library for backporting UITableView/UICollectionViewDiffableDataSource.

Overview

DiffableDataSources

πŸ’Ύ A library for backporting UITableView/UICollectionViewDiffableDataSource
powered by DifferenceKit.

Swift5 Release CocoaPods Carthage Swift Package Manager
Build Status Platform Lincense

Made with ❀️ by Ryo Aoyama


Introduction

Apple has announced a diffable data source at WWDC 2019.
It's a great API that easily updating our table view and collection view items using automatic diffing.
However, it's a little while before we can use it in a production service.
That because it requires the latest OS to use.
DiffableDataSources make it possible to introduce almost the same functionality from now on.

Uses a sophisticated open source DifferenceKit for the algorithm engine.
It's extremely fast and completely avoids synchronization bugs, exceptions, and crashes.



Difference from the Official

Spec

  • Supports iOS 9.0+ / macOS 10.11+ / tvOS 9.0+
  • Open sourced algorithm.
  • Duplicate sections or items are allowed.
  • Using performBatchUpdates for diffing updates.

Namings

DiffableDataSources have different class names to avoid conflicts with the official API.
Correspondence table is below.

Official Backported
NSDiffableDataSourceSnapshot DiffableDataSourceSnapshot
UITableViewDiffableDataSource TableViewDiffableDataSource
UICollectionViewDiffableDataSource CollectionViewDiffableDataSource
NSCollectionViewDiffableDataSource CocoaCollectionViewDiffableDataSource

Getting Started

Build Project

$ git clone https://github.com/ra1028/DiffableDataSources.git
$ cd DiffableDataSources/
$ make setup
$ open DiffableDataSources.xcworkspace

Basic Usage

First, define the type representing section.
It should conforms to Hashable for identifies from the all sections.
Type of enum can used conveniently because it conforms Hashable by default.

enum Section {
    case main
}

Then, define the item type conforms to Hashable.

struct User: Hashable {
    var name: String
}

Create a data source object, it will be set to table view automatically.
You should dequeue the non nil cells via closure.

final class UsersViewController: UIViewController {
    let tableView: UITableView = ...

    lazy var dataSource = TableViewDiffableDataSource<Section, User>(tableView: tableView) { tableView, indexPath, user in
        let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
        cell.textLabel?.text = user.name
        return cell
    }

    override func viewDidLoad() {
        super.viewDidLoad()

        tableView.register(UITableViewCell.self, forCellReuseIdentifier: "Cell")
    }
}

Manages and updates the data sources intuitively by intermediating DiffableDataSourceSnapshot.
The UI isn't updated until you apply the edited snapshot object.
Update the UI with diffing animation automatically calculated by applying an edited snapshot.

let users = [
    User(name: "Steve Jobs"),
    User(name: "Stephen Wozniak"),
    User(name: "Tim Cook"),
    User(name: "Jonathan Ive")
]

let snapshot = DiffableDataSourceSnapshot<Section, User>()
snapshot.appendSections([.main])
snapshot.appendItems(users)

dataSource.apply(snapshot) {
    // completion
}

Check the documentation for more detailed API.

[See More Usage]


Requirements

  • Swift 5.0+
  • iOS 9.0+
  • macOS 10.11+
  • tvOS 9.0+

Installation

CocoaPods

Add the following to your Podfile:

pod 'DiffableDataSources'

Carthage

Add the following to your Cartfile:

github "ra1028/DiffableDataSources"

Swift Package Manager

Add the following to the dependencies of your Package.swift:

.package(url: "https://github.com/ra1028/DiffableDataSources.git", from: "x.x.x")

Contributing

Pull requests, bug reports and feature requests are welcome πŸš€
Please see the CONTRIBUTING file for learn how to contribute to DiffableDataSources.


Relations

DifferenceKit

A fast and flexible O(n) difference algorithm framework for Swift collection.

Carbon

A declarative library for building component-based user interfaces in UITableView and UICollectionView.


License

DiffableDataSources is released under the Apache 2.0 License.

Comments
  • Add update support for diff algorithm

    Add update support for diff algorithm

    DifferenceKit use ContentEquatable protocol to produce items update. DataSource wrap items into struct which implement Differentiable protocol. In fact diff algorithm never produce update events, there is only one way - call reload method in DataSource. We would like to implement ContentEquatable for DataSource items and get ChangeSet with updates.

    opened by Tayphoon 6
  • Compiler Error Swift.Collection required

    Compiler Error Swift.Collection required

    Checklist

    • [x] All tests are passed.
    • [x] Searched existing pull requests for ensure not duplicated.

    Description

    Swift Compiler Error because of Collection Naming issue

    Motivation and Context

    Release Build ERROR Swift Compiler!

    opened by Bino90 5
  • Item reloads are not calculated correctly

    Item reloads are not calculated correctly

    Hello!

    First and foremost; γ“γ‚Œγ‚’δ½œγ£γ¦γγ‚Œγ¦γ€γ‚γ‚ŠγŒγ¨γ†γ”γ–γ„γΎγ™οΌεŠ©γ‹γ‚ŠγΎγ—γŸ πŸ™‡πŸ»β€β™‚οΈ

    I have noticed a minor issue, which I have described below using the issue template. I've also forked this repo and applied a fix, which you can find here: https://github.com/simba909/DiffableDataSources

    I would be happy to provide a pull request πŸ‘πŸ»

    Checklist

    • [x] This is not a Apple's bug.
    • [x] Reviewed the README and documents.
    • [x] Searched existing issues for ensure not duplicated.

    Expected Behavior

    When using this library and applying two snapshots after one another, I expect the two snapshots to be correctly differentiated like in Apple's NSDiffableDataSource so that item updates are correctly reflected between the two snapshots. Below is some sample code that demonstrates the use-case:

    struct MyItem: Hashable, Equatable {
        let id: Int
        var name: String
    
        func hash(into hasher: inout Hasher) {
            hasher.combine(id)
        }
    }
    
    let snapshot = DiffableDataSourceSnapshot<Int, MyItem>()
    snapshot.appendSections([0])
    
    let myItem = MyItem(id: 1, name: "Test")
    snapshot.appendItems([myItem])
    
    dataSource.apply(snapshot) // <-- This works great, and as expected
    
    // Now, let's apply another snapshot that includes an update to the item
    let anotherSnapshot = DiffableDataSourceSnapshot<Int, MyItem>()
    anotherSnapshot.appendSections([0])
    
    let updatedItem = MyItem(id: 1, name: "Test 2") // <-- Notice that the id is the same, but the content is different
    anotherSnapshot.appendItems([myItem])
    
    dataSource.apply(anotherSnapshot) // <-- This results in 1 deletion, 1 insertion when it should produce 1 reload
    

    Current Behavior

    Item reloads are not discovered in complex items, because an equality check is used on the SnapshotStructure.Item differenceIdentifier instead of the hash value.

    Steps to Reproduce

    1. Create an Xcode project using this library
    2. Take the small sample pasted above and put it in the project
    3. Run the project, and notice how items are deleted/inserted instead of reloaded
    opened by simba909 4
  • Missing UITableViewDiffableDataSource methods for edit/move rows

    Missing UITableViewDiffableDataSource methods for edit/move rows

    Thank you for creating this project, it's become really useful in few of my projects!

    However I have noticed few methods from the official UITableViewDiffableDataSource are missing from your implementation:

    • func tableView(UITableView, canEditRowAt: IndexPath) -> Bool
    • func tableView(UITableView, canMoveRowAt: IndexPath) -> Bool
    • func tableView(UITableView, cellForRowAt: IndexPath) -> UITableViewCell
    • func tableView(UITableView, commit: UITableViewCell.EditingStyle, forRowAt: IndexPath)
    • func tableView(UITableView, moveRowAt: IndexPath, to: IndexPath)

    Reference: https://developer.apple.com/documentation/uikit/uitableviewdiffabledatasource

    Naturally I'd expect these methods to be open and overridable to be able to construct and apply a new snapshot separately.

    Expected Behavior

    Subclassing the TableViewDiffableDataSource should allow to override and provide a custom implementation for canEditRowAt/canMoveRowAt protocol methods.

    class MyDiffableDataSource: TableViewDiffableDataSource<SectionViewModel, AnyViewModel> {
        func tableView(_: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
            return true
        }
    
        func tableView(_: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
            // Custom implementation
        }
    }
    

    Current Behavior

    Methods canEditRowAt and commit:editingStyle:forRowAt do not get executed when implemented on a subclass. This is probably because the base class does not provide an open/public default implementations for these.

    opened by bobek-balinek 2
  • [WIP] Completion Block for CollectionView and TableView DiffableDatasources

    [WIP] Completion Block for CollectionView and TableView DiffableDatasources

    Checklist

    • [ ] All tests are passed.
    • [ ] Added tests.
    • [ ] Documented the code using Xcode markup.
    • [x] Searched existing pull requests for ensure not duplicated.

    Description

    This library provides a back port to UITableViewDiffableDataSource, UICollectionViewDiffableDataSource, and NSCollectionViewDiffableDataSource and tries to stay as close to the API as possible.

    However, one part of the API is missing for UICollectionView and UITableView that does not exist for NSCollectionView which is the Completio block of applying the difference.

    UIKIt: apply(_:animatingDifferences:completion:) AppKit: applySnapshot:animatingDifferences:

    However, to achieve this we would need to change the internals of DifferenceKit on the reload method to accept a completion block and call it once it is done applying the difference.

    Motivation and Context

    By providing a completion on apply method, the API will be exactly as Apple's APIs.

    Impact on Existing Code

    As Apple's API completion block is optional, the function parameter could default to nil and this will not effect the client code and will not cause any breaking changes.

    opened by serjooo 2
  • Create a table view section header or footer view?

    Create a table view section header or footer view?

    Checklist

    • [x] Reviewed the README and documents.
    • [x] Searched existing issues for ensure not duplicated.

    Expected Behavior

    I'd like to show a header or footer view for a section of a table view.

    Current Behavior

    I'm able to use DiffableDataSources to create sections and add items to the section, and this generates cells, but I cannot figure out how to create a header or a footer view (e.g. a UITableViewHeaderFooterView) for a section of the table view.

    For example , if I have:

    enum Section {
      case .greetings
    }
    
    enum Row {
      case .hello
      case .goodbye
    }
    
    func buildSnapshot() {
      let snapshot = DiffableDataSourceSnapshot<Section, AnyHashable>()
      snapshot.appendSections([.greetings])
      snapshot.appendItems(Row.allCases, toSection: .greetings)
      return snapshot
    }
    
    lazy var dataSource = TableViewDiffableDataSource<Section, AnyHashable> (tableView: tableView) { tableView, indexPath, item in
      // this is only called for .hello and .goodbye
      // and i can only return a UITableViewCell - not a UITableViewHeaderFooterView
    }
    
    ## Environment
    - version: 0.1.0
    
    - Swift version: 5.0.1
    
    
    opened by xinsight 2
  • create a data source that vends multiple cell types?

    create a data source that vends multiple cell types?

    Checklist

    • [x] Reviewed the README and documents.
    • [x] Searched existing issues for ensure not duplicated.

    Expected Behavior

    I'd like to use DiffableDataSources with different cell types.

    Current Behavior

    I'm able to create a single data source and single cell type and apply the changes. I'm obviously missing something because I cannot figure out how to create a data source that vends multiple object types. (I tried creating multiple data sources, but then ended up with the dreaded UICollectionView exceptions about attempt to delete item 2 from section 0 which only contains 2 items before the update.)

    Detailed Description (Include Screenshots)

    Here is how I'm creating "article" cells. I'm not sure how to create another cell type.

    
    enum Section: Int, CaseIterable {
        case trends = 0
        case articles
    
        var cellIdentifier: String {
            switch self {
            case .trends:
                return "trendCell"
            case .articles:
                return "articleCell"
            }
        }
    }
    
    lazy var dataSource = CollectionViewDiffableDataSource<Section, Article> (collectionView: collectionView) { collectionView, indexPath, _ /*identifier*/ in
        if let cell = collectionView.dequeueReusableCell(withReuseIdentifier: Section.articles.cellIdentifier, for: indexPath) as? ArticleCollectionViewCell {
            cell.article = self.articles[indexPath.item]
            return cell
        }
    
        fatalError()
    }
    
    var articles: [Article] = [] {
        didSet {
    
                let snapshot = DiffableDataSourceSnapshot<Section, Article>()
                snapshot.appendSections([.articles])
                snapshot.appendItems(articles, toSection: .articles)
                dataSource.apply(snapshot, animatingDifferences: true)
            }
        }
    }
    

    Environment

    • version: 0.1.0

    • Swift version: 5.0

    • iOS version: 12.2

    • Xcode version: 10.2.1

    • Devices/Simulators: iPhone X

    • CocoaPods/Carthage version: 0.33.0

    opened by xinsight 2
  • Incorrect items applied on a collection view after data filtering

    Incorrect items applied on a collection view after data filtering

    Checklist

    • [x] This is not an Apple's bug. It works on the original implementation.
    • [x] Reviewed the README and documents.
    • [x] Searched existing issues for ensure not duplicated.

    Expected Behavior

    Applying two sets of trivial data to a collectionview, I expect the UI to match it in all cases - or at least understand which exceptional cases I should guard against and work them around as needed.

    Current Behavior

    Filtering a simple model array to a particular state makes the collection view fail to display them correctly, whereas the apple implementation does it.

    Steps to Reproduce

    1. Create a snapshot from an array of Hashable models that combines the state from an array of model objects (simple id/title strings) and a isFavorite boolean value)
    2. Given a state0 (full list), filter it into state1 (filtered by some criteria)
    3. Filter it again into state1 (different, non-exclusive criteria)
    4. Toggle applying state1 and state2 to the table view. Going from state1 -> state2 yield different changesets every time you run it, most of the time resulting in wrong state

    The collection view shows more items after snapshot from state2 being applied, than the actual array/snapshot has. The indexes get mixed up between what you tap and what is in the source array

    Detailed Description (Include Screenshots)

    I don't understand the cause exactly.

    Reproducible Demo Project

    https://github.com/rafaelnobrekz/DiffableBugRepro

    Environments

    • version: 0.5.0 (DifferenceKit 1.2.0)

    • Swift version: 5.7

    • iOS version: iOS 16

    • Xcode version: Xcode 14

    • Devices/Simulators: iPhone 14 Pro Simulator (iOS 16), iPhone 12 Pro (iOS 16), iPhone 7 Plus (iOS13.7)

    • CocoaPods/Carthage version: n/a (SPM)

    opened by rafaelnobrekz 1
  • Support for ARM64 Macs

    Support for ARM64 Macs

    Checklist

    • [x] All tests are passed.
    • [ ] Added tests.
    • [ ] Documented the code using Xcode markup.
    • [ ] Searched existing pull requests for ensure not duplicated.

    Description

    Similarly to ra1028/DifferenceKit#124, this makes sure the project gets built for ARM64. That requires DifferenceKit 1.2.0 so I updated the dependencies to DifferenceKit.

    Related Issue

    #36

    Motivation and Context

    Impact on Existing Code

    Screenshots (if appropriate)

    opened by vincentisambart 1
  • Add default implementation for other UITableViewDelegate/UICollectionViewDelegate methods

    Add default implementation for other UITableViewDelegate/UICollectionViewDelegate methods

    Checklist

    • [x] All tests are passed.
    • [x] Added tests.
    • [x] Documented the code using Xcode markup.
    • [x] Searched existing pull requests for ensure not duplicated.

    Description

    As per #16 , when implementing a table view delegate there are currently some methods that aren't implemented. It is currently possible to add these methods by using @objc(…) modifier, but I feel like a default, open for overriding implementation achieves a better experience after all.

    Related Issue

    Introduction of default implementations for other UITableViewDelegate and UICollectionViewDelegate methods - #16

    Impact on Existing Code

    No impact on existing code.

    opened by bobek-balinek 1
  • Add subscript function for SectionIdentifierType

    Add subscript function for SectionIdentifierType

    Checklist

    • [x] Reviewed the README and documents.
    • [x] Searched existing issues for ensure not duplicated.

    Description

    We want to have a getter function for the SectionIdentifierType, to be able to use different cell types depending on the section they are in.

    Motivation and Context

    We want to use IBPCollectionViewCompositionalLayout with different layouts per section. IBPCollectionViewCompositionalLayout refers to this datasource library. In the current implementation we were not able to achieve that because of the missing getter for the SectionIdentifierType.

    Proposed Solution

    Adding a subscript function for the SectionIdentifierType.

    opened by RalfK92 1
  • Bump tzinfo from 1.2.5 to 1.2.10

    Bump tzinfo from 1.2.5 to 1.2.10

    Bumps tzinfo from 1.2.5 to 1.2.10.

    Release notes

    Sourced from tzinfo's releases.

    v1.2.10

    TZInfo v1.2.10 on RubyGems.org

    v1.2.9

    • Fixed an incorrect InvalidTimezoneIdentifier exception raised when loading a zoneinfo file that includes rules specifying an additional transition to the final defined offset (for example, Africa/Casablanca in version 2018e of the Time Zone Database). #123.

    TZInfo v1.2.9 on RubyGems.org

    v1.2.8

    • Added support for handling "slim" format zoneinfo files that are produced by default by zic version 2020b and later. The POSIX-style TZ string is now used calculate DST transition times after the final defined transition in the file. The 64-bit section is now always used regardless of whether Time has support for 64-bit times. #120.
    • Rubinius is no longer supported.

    TZInfo v1.2.8 on RubyGems.org

    v1.2.7

    • Fixed 'wrong number of arguments' errors when running on JRuby 9.0. #114.
    • Fixed warnings when running on Ruby 2.8. #112.

    TZInfo v1.2.7 on RubyGems.org

    v1.2.6

    • Timezone#strftime('%s', time) will now return the correct number of seconds since the epoch. #91.
    • Removed the unused TZInfo::RubyDataSource::REQUIRE_PATH constant.
    • Fixed "SecurityError: Insecure operation - require" exceptions when loading data with recent Ruby releases in safe mode.
    • Fixed warnings when running on Ruby 2.7. #106 and #111.

    TZInfo v1.2.6 on RubyGems.org

    Changelog

    Sourced from tzinfo's changelog.

    Version 1.2.10 - 19-Jul-2022

    Version 1.2.9 - 16-Dec-2020

    • Fixed an incorrect InvalidTimezoneIdentifier exception raised when loading a zoneinfo file that includes rules specifying an additional transition to the final defined offset (for example, Africa/Casablanca in version 2018e of the Time Zone Database). #123.

    Version 1.2.8 - 8-Nov-2020

    • Added support for handling "slim" format zoneinfo files that are produced by default by zic version 2020b and later. The POSIX-style TZ string is now used calculate DST transition times after the final defined transition in the file. The 64-bit section is now always used regardless of whether Time has support for 64-bit times. #120.
    • Rubinius is no longer supported.

    Version 1.2.7 - 2-Apr-2020

    • Fixed 'wrong number of arguments' errors when running on JRuby 9.0. #114.
    • Fixed warnings when running on Ruby 2.8. #112.

    Version 1.2.6 - 24-Dec-2019

    • Timezone#strftime('%s', time) will now return the correct number of seconds since the epoch. #91.
    • Removed the unused TZInfo::RubyDataSource::REQUIRE_PATH constant.
    • Fixed "SecurityError: Insecure operation - require" exceptions when loading data with recent Ruby releases in safe mode.
    • Fixed warnings when running on Ruby 2.7. #106 and #111.
    Commits
    • 0814dcd Fix the release date.
    • fd05e2a Preparing v1.2.10.
    • b98c32e Merge branch 'fix-directory-traversal-1.2' into 1.2
    • ac3ee68 Remove unnecessary escaping of + within regex character classes.
    • 9d49bf9 Fix relative path loading tests.
    • 394c381 Remove private_constant for consistency and compatibility.
    • 5e9f990 Exclude Arch Linux's SECURITY file from the time zone index.
    • 17fc9e1 Workaround for 'Permission denied - NUL' errors with JRuby on Windows.
    • 6bd7a51 Update copyright years.
    • 9905ca9 Fix directory traversal in Timezone.get when using Ruby data source
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump cocoapods-downloader from 1.3.0 to 1.6.3

    Bump cocoapods-downloader from 1.3.0 to 1.6.3

    Bumps cocoapods-downloader from 1.3.0 to 1.6.3.

    Release notes

    Sourced from cocoapods-downloader's releases.

    1.6.3

    Enhancements
    • None.
    Bug Fixes
    • None.

    1.6.2

    Enhancements
    • None.
    Bug Fixes
    • None.

    1.6.1

    Enhancements
    • None.
    Bug Fixes
    • None.

    1.6.0

    Enhancements
    • None.
    Bug Fixes
    • Adds a check for command injections in the input for hg and git.
      orta #124

    1.5.1

    Enhancements
    • None.
    Bug Fixes
    • Fix "can't modify frozen string" errors when pods are integrated using the branch option
      buju77 #10920

    1.5.0

    ... (truncated)

    Changelog

    Sourced from cocoapods-downloader's changelog.

    1.6.3 (2022-04-01)

    Enhancements
    • None.
    Bug Fixes
    • None.

    1.6.2 (2022-03-28)

    Enhancements
    • None.
    Bug Fixes
    • None.

    1.6.1 (2022-03-23)

    Enhancements
    • None.
    Bug Fixes
    • None.

    1.6.0 (2022-03-22)

    Enhancements
    • None.
    Bug Fixes
    • Adds a check for command injections in the input for hg and git.
      orta #124

    1.5.1 (2021-09-07)

    Enhancements
    • None.

    ... (truncated)

    Commits
    • c03e2ed Release 1.6.3
    • f75bccc Disable Bazaar tests due to macOS 12.3 not including python2
    • 52a0d54 Merge pull request #128 from CocoaPods/validate_before_dl
    • d27c983 Ensure that the git pre-processor doesn't accidentally bail also
    • 3adfe1f [CHANGELOG] Add empty Master section
    • 591167a Release 1.6.2
    • d2564c3 Merge pull request #127 from CocoaPods/validate_before_dl
    • 99fec61 Switches where we check for invalid input, to move it inside the download fun...
    • 96679f2 [CHANGELOG] Add empty Master section
    • 3a7c54b Release 1.6.1
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Support for ARM64 Macs

    Support for ARM64 Macs

    Checklist

    • [x] Reviewed the README and documents.
    • [x] Searched existing issues for ensure not duplicated.

    Description

    DiffableDataSources should support ARM Macs.

    Motivation and Context

    DiffableDataSources currently only gets built for x86_64 for macOS and the Simulator. Now that all new Macs use an ARM CPU, DiffableDataSources should also be built for ARM.

    Proposed Solution

    opened by vincentisambart 0
  • Added sectionIdentifier(for:) method for data sources

    Added sectionIdentifier(for:) method for data sources

    Checklist

    • [YES] All tests are passed.
    • [YES] Added tests.
    • [YES] Documented the code using Xcode markup.
    • [YES] Searched existing pull requests for ensure not duplicated.

    Description

    Added method sectionIdentifier(for section: Int) -> SectionIdentifierType for data sources.

    Related Issue

    https://github.com/ra1028/DiffableDataSources/issues/33

    opened by absoftware 2
  • Missing section identifier in UICollectionViewDelegate methods when deleting sections

    Missing section identifier in UICollectionViewDelegate methods when deleting sections

    Checklist

    • [YES] Reviewed the README and documents.
    • [YES] Searched existing issues for ensure not duplicated.

    Description

    When it's called just after applying deleted section

        func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
    
            // it crashes when it's called just after applying deleted section
            let sectionIdentifier1 = self.dataSource.snapshot().sectionIdentifiers[section]
    
            // it would be nice to have sth like this as data source is still correct when snapshot actually isn't
            let sectionIdentifier2 = self.dataSource.sectionIdentifier(for: section) 
    
            // I need to know which section is here
        }
    

    then it crashes or it's not possible to get section identifier in UICollectionViewDelegate methods.

    opened by absoftware 1
  • Broken swipe actions

    Broken swipe actions

    Checklist

    • [x ] This is not a Apple's bug.
    • [x ] Reviewed the README and documents.
    • [x ] Searched existing issues for ensure not duplicated.

    Expected Behavior

    trailingSwipeActionsConfigurationForRowAt is called

    Current Behavior

    trailingSwipeActionsConfigurationForRowAt not called

    Steps to Reproduce

    1. Create table view with diffable data source
    2. Implement table view delegate's method tableView( tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath)_ )
    3. Set data source to diffable data source and delegate to self.
    4. See that it's not called

    Environments

    • version: 0.4.0
    • Swift version: 5.2
    • iOS version: 14.2
    • Xcode version: 12.2
    • Devices/Simulators: iPhone 7/iPhone 11 Pro
    • CocoaPods/Carthage version: 0.4.0
    opened by denis-obukhov 1
Releases(0.5.0)
  • 0.5.0(Jun 8, 2021)

    Improvements

    • Support for ARM64 Macs (#37 by @vincentisambart)
    • Add missing sectionIndexTitles method for tableviews (#29 by @jdanthinne)

    Fix

    • Fix compile error of sample mac application (#27 @sidepelican)
    Source code(tar.gz)
    Source code(zip)
  • 0.4.0(Apr 12, 2020)

    Enhancement

    • Add default implementation for other UITableViewDelegate/UICollectionViewDelegate methods (by bobek-balinek, #22)

    Fix

    • Compiler Error Swift.Collection required (by @Bino90, #20)
    Source code(tar.gz)
    Source code(zip)
  • 0.3.0(Dec 10, 2019)

    Enhancement

    • Add support for specifying section header and footer titles (by @simba909 #6)
    • Update Podspec sources to different platforms (by AYastrebov #7)
    • Updates git submodule (by @danmolina21 #11)
    • Add completion block (by @ra1028 #12)
    Source code(tar.gz)
    Source code(zip)
  • 0.2.0(Sep 2, 2019)

  • 0.1.0(Jun 24, 2019)

Owner
Ryo Aoyama
β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–€β–„β–‘β–‘β–‘β–„β–€β–‘β–‘β–‘β–‘β–‘β–‘β–‘ β–‘β–‘β–‘β–‘β–‘β–„β–ˆβ–€β–ˆβ–ˆβ–ˆβ–€β–ˆβ–„β–‘β–‘β–‘β–‘β–‘ β–‘β–‘β–‘β–ˆβ–€β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–€β–ˆβ–‘β–‘β–‘ β–‘β–‘β–‘β–ˆβ–‘β–ˆβ–€β–€β–€β–€β–€β–€β–€β–ˆβ–‘β–ˆβ–‘β–‘β–‘ β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–€β–€β–‘β–‘β–‘β–€β–€β–‘β–‘β–‘β–‘β–‘β–‘β–‘ β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘
Ryo Aoyama
An iOS drop-in UITableView, UICollectionView and UIScrollView superclass category for showing a customizable floating button on top of it.

MEVFloatingButton An iOS drop-in UITableView, UICollectionView, UIScrollView superclass category for showing a customizable floating button on top of

Manuel Escrig 298 Jul 17, 2022
Automates prefetching of content in UITableView and UICollectionView

Automates preheating (prefetching) of content in UITableView and UICollectionView. Deprecated on iOS 10. This library is similar to UITableViewDataSou

Alexander Grebenyuk 633 Sep 16, 2022
Netflix and App Store like UITableView with UICollectionView, written in pure Swift 4.2

GLTableCollectionView Branch Status master develop What it is GLTableCollectionView is a ready to use UITableViewController with a UICollectionView fo

Giulio 708 Nov 17, 2022
Incremental update tool to UITableView and UICollectionView

EditDistance is one of the incremental update tool for UITableView and UICollectionView. The followings show how this library update UI. They generate

Kazuhiro Hayashi 90 Jun 9, 2022
A generic small reusable components for data source implementation for UITableView/UICollectionView in Swift.

GenericDataSource A generic small reusable components for data source implementation for UITableView/UICollectionView written in Swift. Features Basic

null 132 Sep 8, 2021
ZHTCView - UITableview & UICollectionView

ZHTCView θΏ™ζ˜―δΈ€δΈͺ使用Blockζ›Ώζ’δ»£η†ηš„UITableview & UICollectionView。 δ½Ώη”¨ζ–Ήζ³•ε¦‚δΈ‹οΌš - (DSTableView *)tableView { if (!_tableView) { _tableView = DSTableView.

ι»‘ι…’δΈ€ 0 Jan 10, 2022
Easier way to represent the structure of UITableView.

Shoyu Shoyu is a library written in Swift to represent UITableView data structures. Shoyu means Soy Sauce in Japanese. Usage Create single section and

yukiasai 278 Apr 14, 2022
Dwifft is a small Swift library that tells you what the "diff" is between two collections

Dwifft! In 10 seconds Dwifft is a small Swift library that tells you what the "diff" is between two collections, namely, the series of "edit operation

Jack Flintermann 1.8k Dec 12, 2022
PJFDataSource is a small library that provides a simple, clean architecture for your app to manage its data sources while providing a consistent user interface for common content states (i.e. loading, loaded, empty, and error).

PJFDataSource PJFDataSource is a small library that provides a simple, clean architecture for your app to manage its data sources while providing a co

Square 88 Jun 30, 2022
HoverConversion realized vertical paging with UITableView. UIViewController will be paged when reaching top or bottom of UITableView contentOffset.

HoverConversion ManiacDev.com referred. https://maniacdev.com/2016/09/hoverconversion-a-swift-ui-component-for-navigating-between-multiple-table-views

Taiki Suzuki 166 Feb 1, 2022
Carbon🚴 A declarative library for building component-based user interfaces in UITableView and UICollectionView.

A declarative library for building component-based user interfaces in UITableView and UICollectionView. Declarative Component-Based Non-Destructive Pr

Ryo Aoyama 1.2k Jan 5, 2023
Former is a fully customizable Swift library for easy creating UITableView based form.

Former is a fully customizable Swift library for easy creating UITableView based form. Submitting Issues Click HERE to get started with filing a bug r

Ryo Aoyama 1.3k Dec 27, 2022
🚴 A declarative library for building component-based user interfaces in UITableView and UICollectionView.

A declarative library for building component-based user interfaces in UITableView and UICollectionView. Declarative Component-Based Non-Destructive Pr

Ryo Aoyama 1.2k Jan 5, 2023
Nice library to show placeholders and Empty States for any UITableView/UICollectionView in your project

HGPlaceholders Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements iOS 8.0+ Xcode 9

Hamza Ghazouani 2.2k Dec 24, 2022
A UICollectionViewLayout subclass displays its items as rows of items similar to the App Store Feature tab without a nested UITableView/UICollectionView hack.

CollectionViewShelfLayout A UICollectionViewLayout subclass displays its items as rows of items similar to the App Store Feature tab without a nested

Pitiphong Phongpattranont 374 Oct 22, 2022
A view that shows selectable symbols, similar to UITableView's `sectionIndexTitles` API but with support for symbols and more flexibility

?? TableOfContentsSelector Are you familiar with UITableView's sectionIndexTitles API? The little alphabet on the side of some tables for quickly jump

Christian Selig 106 Dec 19, 2022
INTUZ is presenting an interesting a Multilevel Expand/Collapse UITableView App Control to integrate inside your native iOS-based application

INTUZ is presenting an interesting a Multilevel Expand/Collapse UITableView App Control to integrate inside your native iOS-based application. MultilevelTableView is a simple component, which lets you use the tableview with multilevel tree view in your project.

INTUZ 3 Oct 3, 2022
Animated top menu for UITableView / UICollectionView / UIScrollView written in Swift

Persei Animated top menu for UITableView / UICollectionView / UIScrollView written in Swift! Made in Yalantis. Check this project on Dribbble Check th

Yalantis 3.4k Dec 14, 2022
UITableView cell cache that cures scroll-lags on cell instantiating

UITableView + Cache https://github.com/Kilograpp/UITableView-Cache UITableView cell cache that cures scroll-lags on a cell instantiating. Introduction

null 73 Aug 6, 2021
A PageView, which supporting scrolling to transition between a UIView and a UITableView

YXTPageView ##A Page View, which support scrolling to transition between a UIView and a UITableView UIView (at the top) UITableView (at the bottom) In

Hanton Yang 68 May 25, 2022