Comments (6)
Hi @serluca ,
I'm not sure what is the suggestion here.
collectionView(_:layout:referenceSizeForHeaderInSection:)
is part of delegate and not data source, so we can't implement this on data source.
I think that RxDelegate should report collectionView(_:layout:referenceSizeForHeaderInSection:)
wasn't implemented in case delegate isn't implementing it because it has void
return type, so little confused it returns (0, 0). Why do you think it does?
What we could theoretically do is for data source to also implement delegate methods, and then create an extension rx_itemsWithDataSourceAndDelegate
.
from rxdatasources.
Hi @kzaher,
I know is not part of the data source (I don't know why apple did that, I think it should), the problem here is not RxDelegate
is the default UICollectionViewFlowLayoutDelegate
that returns CGSizeZero
.
I like what you are suggesting here:
What we could theoretically do is for data source to also implement delegate methods, and then create an extension
rx_itemsWithDataSourceAndDelegate
.
It would be very cool
from rxdatasources.
Hi @serluca ,
would
What we could theoretically do is for data source to also implement delegate methods, and then create an extension rx_itemsWithDataSourceAndDelegate.
even help in this case. According to this, it sounds like not.
from rxdatasources.
Hi @kzaher
What I'm suggesting here is to have a method that looks like
dataSource.supplementaryViewFactory = { (dataSource, collectionView, kind, indexPath) in
}
But for the delegate method collectionView(_:layout:referenceSizeForHeaderInSection:)
something like
dataSourceAndDelegate.referenceSizeForHeaderFactory = { { (dataSource, collectionView, section)
}
Having this method, we can customize the header size and keep the same syntax that we use for the dataSource.
Right now my code looks like this (and I think is ugly):
class MyClass {
func skinCollectionView() {
dataSource.supplementaryViewFactory = { (dataSource, collectionView, kind, indexPath) in
...
}
}
}
extension MyClass : UICollectionViewDelegateFlowLayout {
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
....
return Size
}
}
from rxdatasources.
Can you make a PR?
from rxdatasources.
I'll try :)
from rxdatasources.
Related Issues (20)
- Issues that result in two section header
- RxTableViewSectionedAnimatedDataSource dataSource sectionModels are always same with newSections HOT 2
- [Carthage] IPHONEOS_DEPLOYMENT_TARGET on Xcode project does not match the SPM target. HOT 1
- RxDataSources collapses HOT 1
- Different version in .podspec from release tag HOT 3
- Reload all but one section
- RxDataSources not supported swift version 5.5.2 HOT 2
- Binding multiple data and cells in RxSwiftDataSource (attempt to insert section 0 but there are only 0 sections after the update)
- .github/workflows/swift.yml HOT 1
- Package.swift HOT 1
- dotnet new console --name OctocatApp
- RxCollectionViewSectionedAnimatedDataSource crash if estimatedItemSize was set in iOS 14.0&14.0.1
- Lack of support UICollectionView delegate method `contextMenuConfigurationForItemAt`or `contextMenuConfigurationForItemsAt`
- IdentifiableType with Unidirectional Data Flow HOT 2
- Question about items function parameters
- Altstore
- CHANGELOG doesn't seem to show you have a 5.0.0 release?
- About customizing row height for RxPickerViewViewAdapter.
- textView in tableView cell
- Privacy Manifest HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rxdatasources.