Hello! THANKS A LOT for your awesome framework.
I managed to migrate it into my project, and now I have 2 sections, both vertical, one above the other.
I am trying to have one of the sections horizontal, but this seems very non trivial to me.
My project architecture is somewhat like this:
I want only my main ViewController to be asking for data. Meaning I want the data class to be a singleton that responds to searches on the main ViewController, and the main ViewController passes the data to its siblings.
So I read every information I could find, and understood that the best method is to implement something like this:
Have a section that wraps a collection view that is a IGListCollectionView, and have that wrapper be also a IGListAdapterDataSource. Maybe I made a mess but I am not sure.
But in this setup I do not understand how I can pass data from the main IGList to the embedded one.
If my question does not make sense at all, please just delete it. I am also available in this Email, incase the question is not appropriate as an issue but still someone wants to help out :), Silberman.[email protected]
Thanks!!
Eyal
README and documentationIGListKit version: 2.0.0Hey @eyzuky! No worries, this is a good question 馃槃
As far as having a horizontally scrollable list, check out our example for how to setup your section controller and cells.
As for how to get the data from the view controller, into the top section controller, and fetch data that powers and embedded adapter+section-controllers, here's what we do at Instagram:
IGListDiffable. Return it in the array of objects that powers the vertical list.Does that make sense? If not, let me know!
Thanks for the answer! we will be working on it and update if we have any problem :)
@eyzuky mind if I close this? Feel free to open a new issue if more stuff comes up 馃槃
Thanks, I don't mind at all.. just before that, I will share my solution because it may be wrong and it may be helpful, I do not know but I would love your opinion about it -
We had to pass an array of an object we created to the nested adapter as a whole, meaning it had to be added in objects for listAdapter in the main adapter as an array (so the main IGListDiffable array that is returned contains a nested array as 1 element). So lets say our final array was something like: [1,2,3, [SomeObject]]. this was hard because an array by itself cannot be extended to conform to be IGListDiffable. So our solution was to wrap it inside a custom class that looks something like:
class SomeObjectWrapper: IGListDiffable{
var objects: [SomeObject]
}
extension ... implementing protocol IGListDiffable....
and then have [1,2,3,SomeObjectWrapper]
This solution worked but to us it was also a little weird that we have to wrap the array in order to pass it through.. we had to pass it as a whole (from my understanding) because I only have 1 cell which holds a collection view.. from there the nested adapter did not have to use this method since all the SomeObject instances are IGListDiffable (when not in an array).
Not weird at all IMO! We do the exact same thing in Instagram. The benefit is it sets up a unique type of data that your section controller uses. Now you'll be able to extend that data in the future w/out effecting other parts of your app.
It adds a little bit of overhead when building, but once done is pretty flexible.
Awesome! 馃拑
Can definitely mark as solved :)
馃帀
Most helpful comment
Not weird at all IMO! We do the exact same thing in Instagram. The benefit is it sets up a unique type of data that your section controller uses. Now you'll be able to extend that data in the future w/out effecting other parts of your app.
It adds a little bit of overhead when building, but once done is pretty flexible.