Iglistkit: How to Pass Back data from Embedded Section Controller to Parent Section Controller

Created on 13 Mar 2018  路  2Comments  路  Source: Instagram/IGListKit

New issue checklist

I am using Embedded Section Controller for displaying a horizontal list as in Demo Project. I am able to get the selected object in Embedded Section Controller through func didSelectItem(at index: Int) but I want to pass back this selected object to Parent Section Controller. How can I achieve this?

Most helpful comment

Use a delegate pattern :) Have a look at the StoryboardLabelSectionController in the iOS examples app for a similar example of this. Essentially you pass the section controller to the delegate and then you can find the object by querying the adapter for the section index in the parent. In the examples app the delegate happens to be a view controller, but it'll be no different with a parent section controller. Hope that helps..

All 2 comments

Use a delegate pattern :) Have a look at the StoryboardLabelSectionController in the iOS examples app for a similar example of this. Essentially you pass the section controller to the delegate and then you can find the object by querying the adapter for the section index in the parent. In the examples app the delegate happens to be a view controller, but it'll be no different with a parent section controller. Hope that helps..

Thanks!

Was this page helpful?
0 / 5 - 0 ratings