Giter VIP home page Giter VIP logo

datasource's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

datasource's Issues

Add verbose logging

Add a possibility to get more information about the used (or missing) identifiers, results of the diffying etc. to debug problems.

Update .podspec with next version number

The .podspec currently specifies version 5.2.0 but the latest tag is 6.x, which leads to some weirdness when I try to run pod update MBDataSource.

My local temporary fix was to write in my Podfile:

pod 'MBDataSource', :git => 'https://github.com/allaboutapps/DataSource.git', :tag => '6.1.2'

But since the podspec is out of date, Cocoapods thinks 5.2 is installed.

Unfortunately I had to investigate the files to confirm that I had the latest code.

Can you update the podspec with the new version, and then move the latest version tag to that commit?

Thanks

Naming-Conflict with Nested Classes or Structs

class TestOne {
    struct Item {
        let value: String
    }
}

class TestTwo {
    struct Item {
        let value: Int
    }
}

dataSource.sections = [Section(items: [TestOne.Item(value: "Hello"), TestTwo.Item(value: 5)])]

This will force a crash because String(describing: type(of: item) will always return Item instead of needed TestOne.Item, TestTwo.Item. So all Items do have the same identifier and cellDescriptor will fail.

Release 1.0

As soon as we feel comfortable with the feature set, we should cut a 1.0 release.

Crash when using cells defined in storyboard

When using Cells that were defined in storyboard (not in .xib or programmatically) the DataSource crashes.

We think it has to do with the DataSource trying to register the cell, even though that was already done by the storyboard.

It is likely caused by a change introduced in #24.

Cartfile missing

Please add a Cartfile to your repository.

The project currently doesn't build with carthage, because carthage cannot detect its dependency on the Differ.framework. carthage uses the Cartfile for dependency tracking, it doesn't even look at Cartfile.resolved.

This doesn't matter if you have Differ included for other reasons. It also doesn't matter if you have Differ already in your Carthage/Build folder and do a carthage update, because carthage update doesn't delete obsolete frameworks from the build folder.

To reproduce this isssue, just create a new empty project with just the DataSource dependency built via carthage. The app does not compile.

Bug - TrailingSwipeAction + SeparatedSection leads to 'Fatal error: Index out of range'

To reproduce this kind of error, add the following code to the datasource of the SeparatedSectionViewController (Example project) and try to swipe the last cell of the section:

.canEdit { [weak self] (_, _) -> Bool in
    return true
}
.trailingSwipeAction { [weak self] (_, _) -> UISwipeActionsConfiguration? in
    return UISwipeActionsConfiguration(actions: [
        UIContextualAction(style: .destructive, title: "Delete", handler: { [weak self] (_, _, callback) in
            callback(true)
        })
    ])
},

Clarify how to update sections & rows

update(rows:) sets rows and visibleRows and may lead to unexpected behaviour when being used in combination with reloadData. Update documentation on how to update section contents.

Crash in DataSource+UITableViewDelegate.swift line 471

I saw a crash in an app of mine, reported via Firebase, in the implementation of tableView(_:trailingSwipeActionsConfigurationForRowAt:).

Affected OS versions: iOS 14.4.1, iOS 14.4.2, iOS 14.5.1, iOS 14.6.0
Affected DataSource version: 8.1.1
Affected Phones: iPhone 7, iPhone 8, iPhone 11, iPhone 11 Pro, iPhone 12, iPhone XR, iPhone SE2
Xcode version used: 12.4

Bildschirmfoto 2021-06-15 um 11 32 37

In the end, the crash lies in IndexPath.section.getter, and an Apple employee explains that this happens because IndexPath.indices.count != 2.

Unfortunately, I can't reproduce the crash and it happens rarely, and I only know about it because of crash reporting. I don't know if it is an iOS bug, a bug in my app, or a bug in DataSource, but I think it can be fixed by adding a safety check to DataSource.

The problem

DataSource.tableView(_:trailingSwipeActionsConfigurationForRowAt:) is called with a bad indexPath that doesn't have two indices (i.e. indexPath.indices.count != 2. But all IndexPath values that are used for a table view should have exactly 2 indices: the "section" and the "row".)
The line let cellDescriptor = self.cellDescriptor(at: indexPath) as? CellDescriptorTypeiOS11 is therefore called with a bad IndexPath.
That method calls DataSource.visibleRow(at:), which is implemented as visibleSections[indexPath.section].visibleRow(at: indexPath.row). And that crashes because indexPath.section crashes.

Possible solution

I would suggest to add a safety check to DataSource.tableView(_:trailingSwipeActionsConfigurationForRowAt:) and DataSource.tableView(_:leadingSwipeActionsConfigurationForRowAt:) like this:

if indexPath.indices.count != 2 {
    return nil
}

because if indexPath.indices.count is not 2, the next line will crash deterministically.


(I could create a pull request if you want)

Improve section diffing

Currently, a Section uses its identifier for matching a SectionDescriptor as well as creating the DiffableSection which is used to compute a diff.
These should be separated.
If the content of a section is Diffable, its diffIdentifier should be used for DiffableSection instead.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.