Comments (11)
Hey @otymartin, here's a rather general description of how I handle this:
- Create an IGListCollectionView with vertical flow layout.
- Create an IGListSectionController backed by a datasource similar to this:
class DataForHorizontalCollectionView: IGListDiffable {
var dataForIndividualCells: [String]?
func diffIdentifier() -> NSObjectProtocol {
// implement this
}
func isEqual(_ object: IGListDiffable?) -> Bool {
//implement this based on the data stored in 'dataForIndividualCells'
}
}
- In your vertical collection view display just one section created in point 2. Also, this section controller should always display just one cell.
- Inside that cell add a UIViewController based container
that has another instance IGListCollectionView in it, this collection view ought to have a horizontal flow layout. In thecellForItem(at index: Int) -> UICollectionViewCell
method of your section controller created in point 2, pass data to your second collection view. - Also, you might want to store the content offset of your horizontal collection in a dictionary. This is nicely described by Ash Furrow in https://ashfurrow.com/blog/putting-a-uicollectionview-in-a-uitableviewcell .
Hope this helps.
from iglistkit.
Thank you for answering this so quickly @jessesquires π β€οΈ
from iglistkit.
@bonzoq Thanks for sharing your solution. Im following along and will reach back when I manage to implement something. Might have some follow up Q's though. (Sticky headers)
from iglistkit.
@otymartin sure thing, let me know if you've any questions whatsoever.
from iglistkit.
@otymartin thanks for your help, I managed to do it with the example (HorizontalSectionController and EmbeddedSectionController in the example project)!
from iglistkit.
Hey @bonzoq ! Definitely ok π π
So far I've been achieving this by putting a collection view in a table view cell.
This is how we currently handle this for our own uses. (Except we put a collection view inside collection view cells β since ListKit is only for collection views.)
We want to provide this functionality "out-of-the-box", but currently don't have a solution. We're tracking this at #31. Let's move this conversation there. π
Along these lines, let's say in addition to that, that we want the first 'horizontal' section to be fixed, meaning that it won't scroll along with the second section. Should we just use two different collection views for those sections in this case?
This would definitely be out-of-scope for #31, but we could address this once #31 is finished.
from iglistkit.
@bonzoq Did you figure this out?
from iglistkit.
@bonzoq I tried to implement this solution but my horizontal collection view is not receiving any touch event and i'm not able to scroll it. Did I missed something?
from iglistkit.
@jr9098 Did you use my method of embedding the collectionview
in a tableview cell
?
from iglistkit.
@otymartin I'm using @bonzoq 5 steps solution
from iglistkit.
@jr9098 I documented my solution in #304 incase. I never managed to implement this method but can't believe it would be that hard, the example projects do it.
from iglistkit.
Related Issues (20)
- Scroll to top on iOS 15 devices has glitch or a behaviour different in the 'main' branch respect to '4.0.0' version for expanded items.
- Xcode 14 + SPM integration = no SwiftUI previews HOT 2
- Refresh without Animation HOT 2
- I found that replacing the IGListCollectionView with a UICollectionView deadlocks the main thread γ I have sample projectsγ
- Need tagged releases in order to use IGListKit SPM package as a dependency of another package HOT 1
- crash with ios 16.4 when build with xcode 14.3 HOT 10
- Crash With IGListDiffKit SIGABRT ABORT HOT 2
- _visibleSectionIndices not being cleaned up in time
- Unable to install via Swift Package Manager HOT 6
- It's time to release a new version. HOT 9
- Unable to find a specification for `IGListSwiftKit` HOT 1
- Long press + Reorder cell
- conversion of 'long' to 'NSString * _Nullable' is disallowed with ARC HOT 1
- Unable to build project using Xcode 15: Undefined symbols
- Xcode14.3 Failed to create 0x88 image slot (alpha=1 wide=1) (client=0xd7743321) [0x5 (os/kern) failure]
- XCode 15 Debug iOS 14.3 iphone will crash, how to solution it ?
- Help find cause wrong collectionview cell height size after perform update HOT 1
- Privacy Manifest HOT 4
- [feature] Implement Viewer Search Functionality for Stories HOT 1
- Issue with changed message and pop up notification HOT 1
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 iglistkit.