-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Infinum/feature/diffable data source and animators #58
base: master
Are you sure you want to change the base?
Infinum/feature/diffable data source and animators #58
Conversation
/// and all `TableCelItem` objects (in the `TableSectionItem`) **must** conform to `CellItemIdentifiable` | ||
/// | ||
@available(iOS 13.0, *) | ||
public final class TableDiffableDataSourceDelegate: UITableViewDiffableDataSource<AnyHashable, AnyHashable>, UITableViewDelegate { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH I would leave it generic.
For supporting different cell types, I would go with crating result builder for cell items 😄
I would rather go with UITableViewDiffableDataSource for iOS13+ than my custom implementation from file ⬆️ 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is tailored with some publishers we can listen to, as we have with the default TableDataSourceDelegate. What do you mean by leaving it generic? It's constrained to Hashable anyway even with the base implementation. Would love to hear more about the result builder for cell items idea 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't figure out what @Truba had here in mind. Maybe that you should not use AnyHashable, instead we should use generic types here like in the definition of NSDiffableDataSourceSnapshot
NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType> : @unchecked Sendable where SectionIdentifierType : Hashable, SectionIdentifierType : Sendable, ItemIdentifierType : Hashable, ItemIdentifierType : Sendable { }
Regarding result builders, I guess what should be done here is some result builder for sections/items
e.g. something like this
@SectionBuilder
func cellItems(models: SomeModel) -> [TableSectionItem] {
MySectionItem {
for mode in models {
MyTableCelItem(model: model)
}
}
EmptySection(title: "someTitle")
MySection2 {
if isEnd {
PageEndItem()
} else {
LoaderTableItem()
}
}
}
¯_(ツ)_/¯ Something like this
Sources/UI/DataSourceDelegate/Swift/Table View/Animator/TableCellAnimator.swift
Show resolved
Hide resolved
I know this is quite old, but can this be revisited? Should we improve and merge this one or close? |
Hi @nikolamajcen, |
Hey @ZvonimirMedak , that's fine. It does not to be instant, but it would be great if you could find someone to resolve this. |
Description
I've added
CombineTableDataSourceDelegate
,TableDiffableDataSourceDelegate
,TableCellAnimator
and updatedTableCellItem
. Updated the Combine paging example with an example animation to show off how you can create your own and use it.Checklist:
public
modifier for all method and properties that could be changed from user of your feature, andprivate
for internal properties.