allaboutapps / datasource Goto Github PK
View Code? Open in Web Editor NEWSimplifies the setup of UITableView data sources using type-safe descriptors for cells and sections. Animated diffing built-in.
License: MIT License
Simplifies the setup of UITableView data sources using type-safe descriptors for cells and sections. Animated diffing built-in.
License: MIT License
Migrate code to Swift 4
SeparatorLineCell should be marked as not accessible so it is ignored by VoiceOver like a normal system separator.
Add a possibility to get more information about the used (or missing) identifiers, results of the diffying etc. to debug problems.
Currently the data source doesn't support scroll view delegate methods.
When using the UITableView extension's height functions, the height for the section footer doesn't get calculated correctly if a footer is present.
This is will be an issue when using support for section footers (#4).
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
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.
As soon as we feel comfortable with the feature set, we should cut a 1.0
release.
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.
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)
})
])
},
Move to https://github.com/ra1028/DifferenceKit for diffing algorithm.
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.
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
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.
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.
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)
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.