Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass multiple objects to IGListKit Section Controller

I'm using IGListStackedSectionController and I want to know how to pass multiple objects to any of given childs.

I have a scenario like this:

let sectionController = IGListStackedSectionController(sectionControllers: [
            WorkingRangeSectionController(),
            DisplaySectionController(),
            HorizontalSectionController(),
            ])!

Let's say I want to put a dynamic title on the first section, an array of images in the second section and a different array of images on the last section.

How would I do that?

Thanks a lot!

like image 900
Renan Kosicki Avatar asked Feb 05 '23 06:02

Renan Kosicki


1 Answers

Short answer:

You can't do this. Same object is passed to all subsection controllers.

Long answer:

You can combine all necessary data to a class, e.g.:

class Model {
    var title = ""
    var images = [UIImage]()
    var otherImages = [UIImage]()
}

You also need to implement IGListDiffable protocol according to your needs.

There is brief example of IGListStackedSectionController in IGListKit examples on GitHub.

like image 185
frozen_lion Avatar answered Feb 13 '23 07:02

frozen_lion